@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * |
| 65 | 65 | * @param string $user_dn The user DN for which to infer the rules |
| 66 | 66 | * @param array $ownerships The owned groups for the user DN |
| 67 | - * @return array The roles of the given user |
|
| 67 | + * @return string[] The roles of the given user |
|
| 68 | 68 | */ |
| 69 | 69 | private function getRoles($user_dn, $ownerships) |
| 70 | 70 | { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * Retrieves all members for the given group CN |
| 151 | 151 | * |
| 152 | 152 | * @param string $group_ou The common name of the group for which we want to retrieve the members |
| 153 | - * @param array $fields A list of fields we want to return from the search |
|
| 153 | + * @param string[] $fields A list of fields we want to return from the search |
|
| 154 | 154 | * @return bool|\Zend\Ldap\Collection |
| 155 | 155 | * @throws LdapException |
| 156 | 156 | */ |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * Retrieves all memberships for the given DN |
| 220 | 220 | * |
| 221 | 221 | * @param string $user_dn The DN for which to get the memberships |
| 222 | - * @param array $fields A list of fields we want to return from the search |
|
| 222 | + * @param string[] $fields A list of fields we want to return from the search |
|
| 223 | 223 | * @param string $attribute The attribute which we use for filtering |
| 224 | 224 | * @return bool|\Zend\Ldap\Collection |
| 225 | 225 | * @throws LdapException |
@@ -183,10 +183,11 @@ |
||
| 183 | 183 | ['dn', 'uid', 'cn', 'displayName', $attribute], |
| 184 | 184 | 'dn' |
| 185 | 185 | ); |
| 186 | - if ($results->count() > 0) |
|
| 187 | - return $results->getFirst(); |
|
| 188 | - else |
|
| 189 | - return false; |
|
| 186 | + if ($results->count() > 0) { |
|
| 187 | + return $results->getFirst(); |
|
| 188 | + } else { |
|
| 189 | + return false; |
|
| 190 | + } |
|
| 190 | 191 | } |
| 191 | 192 | |
| 192 | 193 | /** |
@@ -65,7 +65,8 @@ discard block |
||
| 65 | 65 | $groupDN = sprintf('ou=%s,ou=groups,o=sog-de,dc=sog', $groupOU); |
| 66 | 66 | $groupAttr = $app['ldap']->getEntry($groupDN, ['cn', 'owner']); |
| 67 | 67 | |
| 68 | - switch ($action) { |
|
| 68 | + switch ($action) |
|
| 69 | + { |
|
| 69 | 70 | case 'quit': |
| 70 | 71 | try { |
| 71 | 72 | if (in_array($userDN, $groupAttr['owner'])) { |
@@ -112,15 +113,23 @@ discard block |
||
| 112 | 113 | $groupList = []; |
| 113 | 114 | foreach ($groups as $g) { |
| 114 | 115 | $roles = []; |
| 115 | - if (isset($g['owner']) && in_array($userDN, $g['owner'])) $roles[] = 'owner'; |
|
| 116 | - if (isset($g['member']) && in_array($userDN, $g['member'])) $roles[] = 'member'; |
|
| 117 | - if (isset($g['pending']) && in_array($userDN, $g['pending'])) $roles[] = 'pending'; |
|
| 116 | + if (isset($g['owner']) && in_array($userDN, $g['owner'])) { |
|
| 117 | + $roles[] = 'owner'; |
|
| 118 | + } |
|
| 119 | + if (isset($g['member']) && in_array($userDN, $g['member'])) { |
|
| 120 | + $roles[] = 'member'; |
|
| 121 | + } |
|
| 122 | + if (isset($g['pending']) && in_array($userDN, $g['pending'])) { |
|
| 123 | + $roles[] = 'pending'; |
|
| 124 | + } |
|
| 118 | 125 | |
| 119 | 126 | $owners = []; |
| 120 | 127 | if (isset($g['owner'])) { |
| 121 | 128 | for ($j = 0; $j < count($g['owner']); $j++) { |
| 122 | 129 | $o = $app['ldap']->getEntry($g['owner'][$j], ['cn', 'mail']); |
| 123 | - if (isset($o)) $owners[] = $o; |
|
| 130 | + if (isset($o)) { |
|
| 131 | + $owners[] = $o; |
|
| 132 | + } |
|
| 124 | 133 | } |
| 125 | 134 | } |
| 126 | 135 | |
@@ -155,7 +164,9 @@ discard block |
||
| 155 | 164 | return new \Symfony\Component\HttpFoundation\RedirectResponse('/members/Benutzerdaten'); |
| 156 | 165 | } |
| 157 | 166 | |
| 158 | - if (!isset($selGroup)) $selGroup = $ownedGroups[0]['ou'][0]; |
|
| 167 | + if (!isset($selGroup)) { |
|
| 168 | + $selGroup = $ownedGroups[0]['ou'][0]; |
|
| 169 | + } |
|
| 159 | 170 | $selGroupDN = sprintf('ou=%s,ou=groups,o=sog-de,dc=sog', $selGroup); |
| 160 | 171 | |
| 161 | 172 | $action = $request->request->get('manage-action'); |
@@ -178,7 +189,8 @@ discard block |
||
| 178 | 189 | |
| 179 | 190 | $groupAttr = $app['ldap']->getEntry($selGroupDN, ['owner']); |
| 180 | 191 | |
| 181 | - switch ($action) { |
|
| 192 | + switch ($action) |
|
| 193 | + { |
|
| 182 | 194 | case 'activate': |
| 183 | 195 | try { |
| 184 | 196 | $app['ldap']->activateMember($userID); |
@@ -231,11 +243,19 @@ discard block |
||
| 231 | 243 | $memberList = []; |
| 232 | 244 | foreach ($allUsers as $u) { |
| 233 | 245 | $roles = []; |
| 234 | - if (isset($groupAttr['owner']) && in_array($u['dn'], $groupAttr['owner'])) $roles[] = 'owner'; |
|
| 235 | - if (isset($groupAttr['member']) && in_array($u['dn'], $groupAttr['member'])) $roles[] = 'member'; |
|
| 236 | - if (isset($groupAttr['pending']) && in_array($u['dn'], $groupAttr['pending'])) $roles[] = 'pending'; |
|
| 246 | + if (isset($groupAttr['owner']) && in_array($u['dn'], $groupAttr['owner'])) { |
|
| 247 | + $roles[] = 'owner'; |
|
| 248 | + } |
|
| 249 | + if (isset($groupAttr['member']) && in_array($u['dn'], $groupAttr['member'])) { |
|
| 250 | + $roles[] = 'member'; |
|
| 251 | + } |
|
| 252 | + if (isset($groupAttr['pending']) && in_array($u['dn'], $groupAttr['pending'])) { |
|
| 253 | + $roles[] = 'pending'; |
|
| 254 | + } |
|
| 237 | 255 | // we handle inactive members like the other cases, the UI is just so similar |
| 238 | - if (strstr($u['dn'], 'ou=inactive')) $roles[] = 'inactive'; |
|
| 256 | + if (strstr($u['dn'], 'ou=inactive')) { |
|
| 257 | + $roles[] = 'inactive'; |
|
| 258 | + } |
|
| 239 | 259 | |
| 240 | 260 | $listentry = array( |
| 241 | 261 | 'name' => $u['cn'][0], |
@@ -85,7 +85,9 @@ discard block |
||
| 85 | 85 | $ownedGroups = $app['ldap']->getOwnedGroups($user->getAttributes()['dn'])->toArray(); |
| 86 | 86 | |
| 87 | 87 | $selGroup = $request->request->get('ou'); |
| 88 | - if (!isset($selGroup)) $selGroup = $ownedGroups[0]['ou'][0]; |
|
| 88 | + if (!isset($selGroup)) { |
|
| 89 | + $selGroup = $ownedGroups[0]['ou'][0]; |
|
| 90 | + } |
|
| 89 | 91 | $selGroupDN = sprintf('ou=%s,ou=groups,o=sog-de,dc=sog', $selGroup); |
| 90 | 92 | |
| 91 | 93 | foreach ($ownedGroups as $og) { |
@@ -151,9 +153,10 @@ discard block |
||
| 151 | 153 | private function retrieveGuestByMail($mail) |
| 152 | 154 | { |
| 153 | 155 | $info = $this->app['ldap']->getMemberByMail($mail, 'mail'); |
| 154 | - if (is_array($info)) |
|
| 155 | - return $info['dn']; |
|
| 156 | - else |
|
| 157 | - return false; |
|
| 156 | + if (is_array($info)) { |
|
| 157 | + return $info['dn']; |
|
| 158 | + } else { |
|
| 159 | + return false; |
|
| 160 | + } |
|
| 158 | 161 | } |
| 159 | 162 | } |
| 160 | 163 | \ No newline at end of file |