Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit f534453

Browse files
author
Dominik František Bučík
authored
Merge pull request #280 from dBucik/fix_ldap_searches
fix: 🐛 Fix fetching capabilities with no facility provided
2 parents 34e1087 + 0469f41 commit f534453

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/AdapterLdap.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ public function getFacilitiesByEntityId($spEntityId)
330330

331331
public function getFacilityByEntityId($spEntityId, $entityIdAttr = 'perunFacilityAttr_entityID')
332332
{
333+
if (empty($spEntityId)) {
334+
return null;
335+
}
333336
$attrName = AttributeUtils::getLdapAttrName($entityIdAttr);
334337
if (empty($attrName)) {
335338
$attrName = 'entityID';
@@ -359,6 +362,9 @@ public function getFacilityByEntityId($spEntityId, $entityIdAttr = 'perunFacilit
359362

360363
public function getFacilityByClientId($clientId, $clientIdAttr = 'perunFacilityAttr_OIDCClientID')
361364
{
365+
if (empty($spEntityId)) {
366+
return null;
367+
}
362368
$attrName = AttributeUtils::getLdapAttrName($clientIdAttr);
363369
if (empty($attrName)) {
364370
$attrName = 'OIDCClientID';
@@ -605,6 +611,9 @@ public function getResourceCapabilities($entityId, $userGroups, $entityIdAttr =
605611

606612
public function getFacilityCapabilities($entityId, $entityIdAttr = 'perunFacilityAttr_entityID')
607613
{
614+
if (empty($entityId)) {
615+
return [];
616+
}
608617
$attrName = AttributeUtils::getLdapAttrName($entityIdAttr);
609618

610619
$facilityCapabilities = $this->connector->searchForEntity(

0 commit comments

Comments
 (0)