Skip to content
Snippets Groups Projects

implement AdapterLdap::getFacilityAttribute

Closed Pavel Břoušek requested to merge github/fork/melanger/patch-7 into master
1 file
+ 16
2
Compare changes
  • Side-by-side
  • Inline
+ 16
2
@@ -267,8 +267,22 @@ class AdapterLdap extends Adapter
@@ -267,8 +267,22 @@ class AdapterLdap extends Adapter
public function getFacilityAttribute($facility, $attrName)
public function getFacilityAttribute($facility, $attrName)
{
{
throw new BadMethodCallException('NotImplementedException');
$attrName = end(explode(':', $attrName));
// TODO: Implement getFacilityAttribute() method.
$ldapResult = $this->connector->searchForEntity(
 
$this->ldapBase,
 
'(&(objectClass=perunFacility)(entityID=' . $facility->getEntityId() . '))',
 
[$attrName]
 
);
 
 
if ($ldapResult === null) {
 
Logger::warning(sprintf(
 
'perun:AdapterLdap: No facility with entityID \'%s\' found.',
 
$facility->getEntityId()
 
));
 
return null;
 
}
 
 
return $ldapResult[$attrName] ?? null;
}
}
public function searchFacilitiesByAttributeValue($attribute)
public function searchFacilitiesByAttributeValue($attribute)
Loading