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

Commit 8979633

Browse files
committed
Fixed some bugs in counting isCesnetElibile
* Fixed some bugs in counting isCesnetElibile for sponsored accounts: ** Show warning in case of one attributes has not been defined ** Log info in case of one of the received values from Perun has an empty value
1 parent 6c7e9a7 commit 8979633

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
5+
#### Fixed
6+
* Fixed some bugs in counting isCesnetElibile for sponsored accounts
57

68
## [v2.5.1]
79
#### Fixed

lib/Auth/Process/IsCesnetEligible.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ public function __construct($config, $reserved)
7878
);
7979
}
8080

81+
if (isset($this->userAffiliationsAttrName, $this->userSponsoringOrganizationsAttrName)) {
82+
Logger::warning(
83+
'cesnet:IsCesnetEligible - One of attributes [' . $this->userAffiliationsAttrName . ', ' .
84+
$this->userSponsoringOrganizationsAttrName . '] wasn\'t set!'
85+
);
86+
}
87+
8188
$this->rpcAttrName = $config[self::RPC_ATTRIBUTE_NAME];
8289

8390
$this->cesnetLdapConnector = (new AdapterLdap(self::CONFIG_FILE_NAME))->getConnector();
@@ -203,6 +210,11 @@ private function isCesnetEligible($user): bool
203210
$perunUserSponsoringOrganizations = $userAttributes[$this->userSponsoringOrganizationsAttrName] ?? [];
204211

205212
if (empty($perunUserAffiliations) || empty($perunUserSponsoringOrganizations)) {
213+
Logger::debug(
214+
'cesnet:IsCesnetEligible - One of attributes [' . $this->userAffiliationsAttrName . ':' .
215+
$perunUserAffiliations . ', ' . print_r($this->userSponsoringOrganizationsAttrName, true).
216+
':' . print_r($perunUserSponsoringOrganizations, true) . '] has empty value!'
217+
);
206218
return false;
207219
}
208220

0 commit comments

Comments
 (0)