@@ -29,9 +29,6 @@ class AdapterLdap extends Adapter
2929 const LDAP_PASSWORD = 'ldap.password ' ;
3030 const LDAP_BASE = 'ldap.base ' ;
3131
32- private $ ldapHostname ;
33- private $ ldapUser ;
34- private $ ldapPassword ;
3532 private $ ldapBase ;
3633
3734 protected $ connector ;
@@ -44,13 +41,12 @@ public function __construct($configFileName = null)
4441
4542 $ conf = Configuration::getConfig ($ configFileName );
4643
47- $ this -> ldapHostname = $ conf ->getString (self ::LDAP_HOSTNAME );
48- $ this -> ldapUser = $ conf ->getString (self ::LDAP_USER , null );
49- $ this -> ldapPassword = $ conf ->getString (self ::LDAP_PASSWORD , null );
44+ $ ldapHostname = $ conf ->getString (self ::LDAP_HOSTNAME );
45+ $ ldapUser = $ conf ->getString (self ::LDAP_USER , null );
46+ $ ldapPassword = $ conf ->getString (self ::LDAP_PASSWORD , null );
5047 $ this ->ldapBase = $ conf ->getString (self ::LDAP_BASE );
5148
52-
53- $ this ->connector = new LdapConnector ($ this ->ldapHostname , $ this ->ldapUser , $ this ->ldapPassword );
49+ $ this ->connector = new LdapConnector ($ ldapHostname , $ ldapUser , $ ldapPassword );
5450 }
5551
5652 public function getPerunUser ($ idpEntityId , $ uids )
@@ -122,9 +118,16 @@ public function getMemberGroups($user, $vo)
122118
123119 public function getSpGroups ($ spEntityId )
124120 {
121+ $ facility = $ this ->connector ->searchForEntity (
122+ $ this ->ldapBase ,
123+ "(&(objectClass=perunFacility)(entityID= $ spEntityId)) " ,
124+ ['perunFacilityId ' ]
125+ );
126+
127+ $ id = $ facility ['perunFacilityId ' ][0 ];
125128 $ resources = $ this ->connector ->searchForEntities (
126129 $ this ->ldapBase ,
127- "(&(objectClass=perunResource)(entityID= $ spEntityId )) " ,
130+ "(&(objectClass=perunResource)(perunFacilityDn=perunFacilityId= $ id , $ this -> ldapBase )) " ,
128131 ["perunResourceId " , "assignedGroupId " , "perunVoId " ]
129132 );
130133
@@ -274,9 +277,16 @@ public function setUserExtSourceAttributes($userExtSourceId, $attributes)
274277
275278 public function getUsersGroupsOnFacility ($ spEntityId , $ userId )
276279 {
280+ $ facility = $ this ->connector ->searchForEntity (
281+ $ this ->ldapBase ,
282+ "(&(objectClass=perunFacility)(entityID= $ spEntityId)) " ,
283+ ['perunFacilityId ' ]
284+ );
285+
286+ $ id = $ facility ['perunFacilityId ' ][0 ];
277287 $ resources = $ this ->connector ->searchForEntities (
278288 $ this ->ldapBase ,
279- "(&(objectClass=perunResource)(entityID= $ spEntityId )) " ,
289+ "(&(objectClass=perunResource)(perunFacilityDn=perunFacilityId= $ id , $ this -> ldapBase )) " ,
280290 ["perunResourceId " ]
281291 );
282292 Logger::debug ("Resources - " . var_export ($ resources , true ));
0 commit comments