@@ -54,17 +54,17 @@ public function getPerunUser($idpEntityId, $uids)
5454 # Build a LDAP query, we are searching for the user who has at least one of the uid
5555 $ query = '' ;
5656 foreach ($ uids as $ uid ) {
57- $ query .= " (eduPersonPrincipalNames= $ uid) " ;
57+ $ query .= ' (eduPersonPrincipalNames= ' . $ uid . ' ) ' ;
5858 }
5959
6060 if (empty ($ query )) {
6161 return null ;
6262 }
6363
6464 $ user = $ this ->connector ->searchForEntity (
65- " ou=People, " . $ this ->ldapBase ,
66- " (| $ query) " ,
67- [" perunUserId " , " displayName " , " cn " , " givenName " , " sn " , " preferredMail " , " mail " ]
65+ ' ou=People, ' . $ this ->ldapBase ,
66+ ' (| ' . $ query . ' ) ' ,
67+ [' perunUserId ' , ' displayName ' , ' cn ' , ' givenName ' , ' sn ' , ' preferredMail ' , ' mail ' ]
6868 );
6969 if ($ user === null ) {
7070 return $ user ;
@@ -84,9 +84,9 @@ public function getMemberGroups($user, $vo)
8484 {
8585 $ userId = $ user ->getId ();
8686 $ userWithMembership = $ this ->connector ->searchForEntity (
87- " perunUserId= $ userId,ou=People, " . $ this ->ldapBase ,
88- " (objectClass=perunUser) " ,
89- [" perunUserId " , " memberOf " ]
87+ ' perunUserId= ' . $ userId . ' ,ou=People, ' . $ this ->ldapBase ,
88+ ' (objectClass=perunUser) ' ,
89+ [' perunUserId ' , ' memberOf ' ]
9090 );
9191
9292 $ groups = [];
@@ -98,8 +98,8 @@ public function getMemberGroups($user, $vo)
9898
9999 $ group = $ this ->connector ->searchForEntity (
100100 $ groupDn ,
101- " (objectClass=perunGroup) " ,
102- [" perunGroupId " , " cn " , " perunUniqueGroupName " , " perunVoId " , " description " ]
101+ ' (objectClass=perunGroup) ' ,
102+ [' perunGroupId ' , ' cn ' , ' perunUniqueGroupName ' , ' perunVoId ' , ' description ' ]
103103 );
104104 array_push (
105105 $ groups ,
@@ -120,25 +120,25 @@ public function getSpGroups($spEntityId)
120120 {
121121 $ facility = $ this ->connector ->searchForEntity (
122122 $ this ->ldapBase ,
123- " (&(objectClass=perunFacility)(entityID= $ spEntityId)) " ,
123+ ' (&(objectClass=perunFacility)(entityID= ' . $ spEntityId . ' )) ' ,
124124 ['perunFacilityId ' ]
125125 );
126126
127127 $ id = $ facility ['perunFacilityId ' ][0 ];
128128 $ resources = $ this ->connector ->searchForEntities (
129129 $ this ->ldapBase ,
130- " (&(objectClass=perunResource)(perunFacilityDn=perunFacilityId= $ id, $ this ->ldapBase )) " ,
131- [" perunResourceId " , " assignedGroupId " , " perunVoId " ]
130+ ' (&(objectClass=perunResource)(perunFacilityDn=perunFacilityId= ' . $ id . ' , ' . $ this ->ldapBase . ' )) ' ,
131+ [' perunResourceId ' , ' assignedGroupId ' , ' perunVoId ' ]
132132 );
133133
134134 $ groups = [];
135135 foreach ($ resources as $ resource ) {
136136 if (isset ($ resource ['assignedGroupId ' ])) {
137137 foreach ($ resource ['assignedGroupId ' ] as $ groupId ) {
138138 $ group = $ this ->connector ->searchForEntity (
139- " perunGroupId= $ groupId,perunVoId= " . $ resource ['perunVoId ' ][0 ] . " , " . $ this ->ldapBase ,
140- " (objectClass=perunGroup) " ,
141- [" perunGroupId " , " cn " , " perunUniqueGroupName " , " perunVoId " , " description " ]
139+ ' perunGroupId= ' . $ groupId . ' ,perunVoId= ' . $ resource ['perunVoId ' ][0 ] . ' , ' . $ this ->ldapBase ,
140+ ' (objectClass=perunGroup) ' ,
141+ [' perunGroupId ' , ' cn ' , ' perunUniqueGroupName ' , ' perunVoId ' , ' description ' ]
142142 );
143143 array_push (
144144 $ groups ,
@@ -162,13 +162,13 @@ public function getGroupByName($vo, $name)
162162 {
163163 $ voId = $ vo ->getId ();
164164 $ group = $ this ->connector ->searchForEntity (
165- " perunVoId= $ voId, " . $ this ->ldapBase ,
166- " (&(objectClass=perunGroup)(perunUniqueGroupName= $ name)) " ,
167- [" perunGroupId " , " cn " , " perunUniqueGroupName " , " perunVoId " , " description " ]
165+ ' perunVoId= ' . $ voId . ' , ' . $ this ->ldapBase ,
166+ ' (&(objectClass=perunGroup)(perunUniqueGroupName= ' . $ name . ' )) ' ,
167+ [' perunGroupId ' , ' cn ' , ' perunUniqueGroupName ' , ' perunVoId ' , ' description ' ]
168168 );
169169 if ($ group === null ) {
170170 throw new Exception (
171- " Group with name: $ name in VO: " . $ vo ->getName () . " does not exists in Perun LDAP. "
171+ ' Group with name: $name in VO: ' . $ vo ->getName () . ' does not exists in Perun LDAP. '
172172 );
173173 }
174174 return new Group (
@@ -184,12 +184,11 @@ public function getVoByShortName($voShortName)
184184 {
185185 $ vo = $ this ->connector ->searchForEntity (
186186 $ this ->ldapBase ,
187- " (&(objectClass=perunVo)(o= $ voShortName)) " ,
188- [" perunVoId " , " o " , " description " ]
187+ ' (&(objectClass=perunVo)(o= ' . $ voShortName . ' )) ' ,
188+ [' perunVoId ' , ' o ' , ' description ' ]
189189 );
190-
191190 if ($ vo === null ) {
192- throw new Exception (" Vo with name: $ vo does not exists in Perun LDAP. " );
191+ throw new Exception (' Vo with name: ' . $ vo . ' does not exists in Perun LDAP.' );
193192 }
194193
195194 return new Vo ($ vo ['perunVoId ' ][0 ], $ vo ['description ' ][0 ], $ vo ['o ' ][0 ]);
@@ -199,12 +198,12 @@ public function getVoById($id)
199198 {
200199 $ vo = $ this ->connector ->searchForEntity (
201200 $ this ->ldapBase ,
202- " (&(objectClass=perunVo)(perunVoId= $ id)) " ,
203- [" o " , " description " ]
201+ ' (&(objectClass=perunVo)(perunVoId= ' . $ id . ' )) ' ,
202+ [' o ' , ' description ' ]
204203 );
205204
206205 if ($ vo === null ) {
207- throw new Exception (" Vo with id: $ id does not exists in Perun LDAP. " );
206+ throw new Exception (' Vo with id: ' . $ id . ' does not exists in Perun LDAP.' );
208207 }
209208
210209 return new Vo ($ id , $ vo ['description ' ][0 ], $ vo ['o ' ][0 ]);
@@ -214,8 +213,8 @@ public function getUserAttributes($user, $attrNames)
214213 {
215214 $ userId = $ user ->getId ();
216215 $ attributes = $ this ->connector ->searchForEntity (
217- " perunUserId= $ userId,ou=People, " . $ this ->ldapBase ,
218- " (objectClass=perunUser) " ,
216+ ' perunUserId= ' . $ userId . ' ,ou=People, ' . $ this ->ldapBase ,
217+ ' (objectClass=perunUser) ' ,
219218 $ attrNames
220219 );
221220 // user in ldap (simplified by LdapConnector method) is actually set of its attributes
@@ -229,31 +228,31 @@ public function getFacilitiesByEntityId($spEntityId)
229228
230229 public function getEntitylessAttribute ($ attrName )
231230 {
232- throw new BadMethodCallException (" NotImplementedException " );
231+ throw new BadMethodCallException (' NotImplementedException ' );
233232 // TODO: Implement getEntitylessAttribute() method.
234233 }
235234
236235 public function getVoAttributes ($ vo , $ attrNames )
237236 {
238- throw new BadMethodCallException (" NotImplementedException " );
237+ throw new BadMethodCallException (' NotImplementedException ' );
239238 // TODO: Implement getVoAttribute() method.
240239 }
241240
242241 public function getFacilityAttribute ($ facility , $ attrName )
243242 {
244- throw new BadMethodCallException (" NotImplementedException " );
243+ throw new BadMethodCallException (' NotImplementedException ' );
245244 // TODO: Implement getFacilityAttribute() method.
246245 }
247246
248247 public function searchFacilitiesByAttributeValue ($ attribute )
249248 {
250- throw new BadMethodCallException (" NotImplementedException " );
249+ throw new BadMethodCallException (' NotImplementedException ' );
251250 // TODO: Implement searchFacilitiesByAttributeValue() method.
252251 }
253252
254253 public function getFacilityAttributes ($ facility , $ attrNames )
255254 {
256- throw new BadMethodCallException (" NotImplementedException " );
255+ throw new BadMethodCallException (' NotImplementedException ' );
257256 // TODO: Implement getFacilityAttributes() method.
258257 }
259258
@@ -281,34 +280,34 @@ public function getUsersGroupsOnFacility($spEntityId, $userId)
281280 {
282281 $ facility = $ this ->connector ->searchForEntity (
283282 $ this ->ldapBase ,
284- " (&(objectClass=perunFacility)(entityID= $ spEntityId)) " ,
283+ ' (&(objectClass=perunFacility)(entityID= ' . $ spEntityId . ' )) ' ,
285284 ['perunFacilityId ' ]
286285 );
287286
288287 $ id = $ facility ['perunFacilityId ' ][0 ];
289288 $ resources = $ this ->connector ->searchForEntities (
290289 $ this ->ldapBase ,
291- " (&(objectClass=perunResource)(perunFacilityDn=perunFacilityId= $ id, $ this ->ldapBase )) " ,
292- [" perunResourceId " ]
290+ ' (&(objectClass=perunResource)(perunFacilityDn=perunFacilityId= ' . $ id . ' , ' . $ this ->ldapBase . ' )) ' ,
291+ [' perunResourceId ' ]
293292 );
294- Logger::debug (" Resources - " . var_export ($ resources , true ));
293+ Logger::debug (' Resources - ' . var_export ($ resources , true ));
295294
296295 if ($ resources === null ) {
297296 throw new Exception (
298- " Service with spEntityId: " . $ spEntityId . " hasn't assigned any resource. "
297+ ' Service with spEntityId: ' . $ spEntityId . ' hasn \ 't assigned any resource. '
299298 );
300299 }
301- $ resourcesString = " (| " ;
300+ $ resourcesString = ' (| ' ;
302301 foreach ($ resources as $ resource ) {
303- $ resourcesString .= " (assignedToResourceId= " . $ resource ['perunResourceId ' ][0 ] . " ) " ;
302+ $ resourcesString .= ' (assignedToResourceId= ' . $ resource ['perunResourceId ' ][0 ] . ' ) ' ;
304303 }
305- $ resourcesString .= " ) " ;
304+ $ resourcesString .= ' ) ' ;
306305
307306 $ resultGroups = [];
308307 $ groups = $ this ->connector ->searchForEntities (
309308 $ this ->ldapBase ,
310- " (&(uniqueMember=perunUserId= " . $ userId . " , ou=People, " . $ this ->ldapBase . " ) " . $ resourcesString . " ) " ,
311- [" perunGroupId " , " cn " , " perunUniqueGroupName " , " perunVoId " , " description " ]
309+ ' (&(uniqueMember=perunUserId= ' . $ userId . ' , ou=People, ' . $ this ->ldapBase . ' ) ' . $ resourcesString . ' ) ' ,
310+ [' perunGroupId ' , ' cn ' , ' perunUniqueGroupName ' , ' perunVoId ' , ' description ' ]
312311 );
313312
314313 foreach ($ groups as $ group ) {
@@ -324,17 +323,17 @@ public function getUsersGroupsOnFacility($spEntityId, $userId)
324323 );
325324 }
326325 $ resultGroups = $ this ->removeDuplicateEntities ($ resultGroups );
327- Logger::debug (" Groups - " . var_export ($ resultGroups , true ));
326+ Logger::debug (' Groups - ' . var_export ($ resultGroups , true ));
328327 return $ resultGroups ;
329328 }
330329
331330 public function getMemberStatusByUserAndVo ($ user , $ vo )
332331 {
333332 $ groupId = $ this ->connector ->searchForEntity (
334333 $ this ->ldapBase ,
335- " (&(objectClass=perunGroup)(cn=members)(perunVoId= " . $ vo ->getId () .
336- " )(uniqueMember=perunUserId= " . $ user ->getId () . " , ou=People, " . $ this ->ldapBase . " )) " ,
337- [" perunGroupid " ]
334+ ' (&(objectClass=perunGroup)(cn=members)(perunVoId= ' . $ vo ->getId () .
335+ ' )(uniqueMember=perunUserId= ' . $ user ->getId () . ' , ou=People, ' . $ this ->ldapBase . ' )) ' ,
336+ [' perunGroupid ' ]
338337 );
339338
340339 if (empty ($ groupId )) {
0 commit comments