blob: 9aed489bea9189a3fb1bf2b69bb84e960f285f56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
<?php
namespace app\extends;
use User;
use Registry;
/** Classroom_user
*
* extends (anom's) User
*
* this way it specializes the UserManagement
* according to this app's special rules
*
* Add privileges concept
* ---
* A Class_user has privileges (which are deferent than Roles)
* In fact, privileges extend the authorization requirements for users
*
* Authorized content is marked with some 'minimum Privilege'
* So the content is available to the READER(s) that have certain Privileges
*
*/
class App_user extends User
{
/** user id
* @var int
*/
private $id;
/** user privileges
* @var array
*/
private $privileges = [];
/** user name
* @var string
*/
private $name;
/** SETTERS AND GETTERS
* for id, name, privileges attributes
* -------------------------------------------------------------------------
*/
// id
// --- -- -- - - -
/** getID
* @return int
*/
public function getID(): int
{
return $this->id;
}
/** setID()
*
* @param int : user id
*
* @return User
*/
public function setID(int $id): self
{
$this->id = $id;
return $this;
}
// name
// --- -- -- - - -
/** getName
* @return int
*/
public function getName(): string
{
return $this->name;
}
/** setName()
*
* @param string : user's full name
*
* @return User
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
// privileges
// --- -- -- - - -
/** getPrivileges
*
* @return privileges (array)
*/
public function getPrivileges(): array
{
return $this->privileges;
}
/** setPrivileges()
*
* @param array $privileges
*
* @return User
*/
public function setPrivileges(array $privileges): self
{
$this->privileges = $privileges;
return $this;
}
}
|