From 89796335c3d69da1ddbabbd957c03852b67bded9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Vysko=C4=8Dil?= <vyskocilpavel@muni.cz> Date: Thu, 20 Aug 2020 08:30:40 +0200 Subject: [PATCH] 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 --- CHANGELOG.md | 2 ++ lib/Auth/Process/IsCesnetEligible.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c187151..125b711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +#### Fixed +* Fixed some bugs in counting isCesnetElibile for sponsored accounts ## [v2.5.1] #### Fixed diff --git a/lib/Auth/Process/IsCesnetEligible.php b/lib/Auth/Process/IsCesnetEligible.php index 103a1fb..8bed5a8 100644 --- a/lib/Auth/Process/IsCesnetEligible.php +++ b/lib/Auth/Process/IsCesnetEligible.php @@ -78,6 +78,13 @@ class IsCesnetEligible extends ProcessingFilter ); } + if (isset($this->userAffiliationsAttrName, $this->userSponsoringOrganizationsAttrName)) { + Logger::warning( + 'cesnet:IsCesnetEligible - One of attributes [' . $this->userAffiliationsAttrName . ', ' . + $this->userSponsoringOrganizationsAttrName . '] wasn\'t set!' + ); + } + $this->rpcAttrName = $config[self::RPC_ATTRIBUTE_NAME]; $this->cesnetLdapConnector = (new AdapterLdap(self::CONFIG_FILE_NAME))->getConnector(); @@ -203,6 +210,11 @@ class IsCesnetEligible extends ProcessingFilter $perunUserSponsoringOrganizations = $userAttributes[$this->userSponsoringOrganizationsAttrName] ?? []; if (empty($perunUserAffiliations) || empty($perunUserSponsoringOrganizations)) { + Logger::debug( + 'cesnet:IsCesnetEligible - One of attributes [' . $this->userAffiliationsAttrName . ':' . + $perunUserAffiliations . ', ' . print_r($this->userSponsoringOrganizationsAttrName, true). + ':' . print_r($perunUserSponsoringOrganizations, true) . '] has empty value!' + ); return false; } -- GitLab