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

Commit

Permalink
fix: 🐛 Fix fetching capabilities with no facility provided
Browse files Browse the repository at this point in the history
Caused exceptions when no facility has been found. Added additional
checks to prevent such errors.
  • Loading branch information
Dominik František Bučík committed Jul 18, 2022
1 parent 34e1087 commit 0469f41
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/AdapterLdap.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ public function getFacilitiesByEntityId($spEntityId)

public function getFacilityByEntityId($spEntityId, $entityIdAttr = 'perunFacilityAttr_entityID')
{
if (empty($spEntityId)) {
return null;
}
$attrName = AttributeUtils::getLdapAttrName($entityIdAttr);
if (empty($attrName)) {
$attrName = 'entityID';
Expand Down Expand Up @@ -359,6 +362,9 @@ public function getFacilityByEntityId($spEntityId, $entityIdAttr = 'perunFacilit

public function getFacilityByClientId($clientId, $clientIdAttr = 'perunFacilityAttr_OIDCClientID')
{
if (empty($spEntityId)) {
return null;
}
$attrName = AttributeUtils::getLdapAttrName($clientIdAttr);
if (empty($attrName)) {
$attrName = 'OIDCClientID';
Expand Down Expand Up @@ -605,6 +611,9 @@ public function getResourceCapabilities($entityId, $userGroups, $entityIdAttr =

public function getFacilityCapabilities($entityId, $entityIdAttr = 'perunFacilityAttr_entityID')
{
if (empty($entityId)) {
return [];
}
$attrName = AttributeUtils::getLdapAttrName($entityIdAttr);

$facilityCapabilities = $this->connector->searchForEntity(
Expand Down

0 comments on commit 0469f41

Please sign in to comment.