|
1
|
|
|
<?php |
|
2
|
|
|
namespace Auth; |
|
3
|
|
|
|
|
4
|
|
|
class Group extends \SerializableObject |
|
5
|
|
|
{ |
|
6
|
|
|
public function getGroupName() |
|
7
|
|
|
{ |
|
8
|
|
|
return false; |
|
9
|
|
|
} |
|
10
|
|
|
|
|
11
|
|
|
public function getDescription() |
|
12
|
|
|
{ |
|
13
|
|
|
return false; |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Set the Group's Name |
|
18
|
|
|
* |
|
19
|
|
|
* @param string $name The name for the group |
|
20
|
|
|
* |
|
21
|
|
|
* @return boolean true if the name was successfully updated, false otherwise |
|
22
|
|
|
* |
|
23
|
|
|
* @SuppressWarnings("UnusedFormalParameter") |
|
24
|
|
|
*/ |
|
25
|
|
|
public function setGroupName($name) |
|
26
|
|
|
{ |
|
27
|
|
|
return false; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Set the Group's Description |
|
32
|
|
|
* |
|
33
|
|
|
* @param string $desc The description for the group |
|
34
|
|
|
* |
|
35
|
|
|
* @return boolean true if the description was successfully updated, false otherwise |
|
36
|
|
|
* |
|
37
|
|
|
* @SuppressWarnings("UnusedFormalParameter") |
|
38
|
|
|
*/ |
|
39
|
|
|
public function setDescription($desc) |
|
40
|
|
|
{ |
|
41
|
|
|
return false; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get the UID's of the Group Members |
|
46
|
|
|
* |
|
47
|
|
|
* @param boolean $recursie Include members of child groups |
|
|
|
|
|
|
48
|
|
|
* |
|
49
|
|
|
* @return array Array of UIDs |
|
50
|
|
|
* |
|
51
|
|
|
* @SuppressWarnings("UnusedFormalParameter") |
|
52
|
|
|
*/ |
|
53
|
|
|
public function getMemberUids($recursive = true) |
|
54
|
|
|
{ |
|
55
|
|
|
return array(); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function members($details = false, $recursive = true, $includeGroups = true) |
|
59
|
|
|
{ |
|
60
|
|
|
return array(); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function member_count() |
|
64
|
|
|
{ |
|
65
|
|
|
return count($this->members(false, false, false)); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function clearMembers() |
|
69
|
|
|
{ |
|
70
|
|
|
return false; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function jsonSerialize() |
|
74
|
|
|
{ |
|
75
|
|
|
$group = array(); |
|
76
|
|
|
$group['cn'] = $this->getGroupName(); |
|
77
|
|
|
$group['description'] = $this->getDescription(); |
|
78
|
|
|
$group['member'] = $this->getMemberUids(); |
|
79
|
|
|
return $group; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Get all users that aren't in this group |
|
84
|
|
|
* |
|
85
|
|
|
* @param array|boolean $select The fields to include |
|
86
|
|
|
* |
|
87
|
|
|
* @return array An array of all users not in this group |
|
88
|
|
|
* |
|
89
|
|
|
* @SuppressWarnings("UnusedFormalParameter") |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getNonMembers($select = false) |
|
|
|
|
|
|
92
|
|
|
{ |
|
93
|
|
|
return array(); |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function addMember($name, $isGroup = false, $flush = true) |
|
97
|
|
|
{ |
|
98
|
|
|
return false; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function editGroup($group) |
|
102
|
|
|
{ |
|
103
|
|
|
//Make sure we are bound in write mode |
|
104
|
|
|
$auth = \AuthProvider::getInstance(); |
|
105
|
|
|
$ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator'); |
|
106
|
|
|
$ldap->get_and_bind_server(true); |
|
107
|
|
|
if(isset($group->description)) |
|
108
|
|
|
{ |
|
109
|
|
|
$this->setDescription($group->description); |
|
110
|
|
|
unset($group->description); |
|
111
|
|
|
} |
|
112
|
|
|
if(isset($group->member)) |
|
113
|
|
|
{ |
|
114
|
|
|
$this->clearMembers(); |
|
115
|
|
|
$count = count($group->member); |
|
116
|
|
|
for($i = 0; $i < $count; $i++) |
|
117
|
|
|
{ |
|
118
|
|
|
$isLast = false; |
|
119
|
|
|
if($i === $count - 1) |
|
120
|
|
|
{ |
|
121
|
|
|
$isLast = true; |
|
122
|
|
|
} |
|
123
|
|
|
if(!isset($group->member[$i]->type)) continue; |
|
124
|
|
|
if($group->member[$i]->type === 'Group') |
|
125
|
|
|
{ |
|
126
|
|
|
$this->addMember($group->member[$i]->cn, true, $isLast); |
|
127
|
|
|
} |
|
128
|
|
|
else |
|
129
|
|
|
{ |
|
130
|
|
|
$this->addMember($group->member[$i]->uid, false, $isLast); |
|
131
|
|
|
} |
|
132
|
|
|
} |
|
133
|
|
|
unset($group->member); |
|
134
|
|
|
} |
|
135
|
|
|
return true; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
public static function from_name($name, $data = false) |
|
139
|
|
|
{ |
|
140
|
|
|
return false; |
|
141
|
|
|
} |
|
142
|
|
|
} |
|
143
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$irelandis not defined by the methodfinale(...).The most likely cause is that the parameter was changed, but the annotation was not.