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

Commit

Permalink
fix: use types array and dictionary instead of map
Browse files Browse the repository at this point in the history
previously all arrays were marked as "map" in config but treated as arrays

BREAKING CHANGE: replace "map" in attribute config with either "array" (ArrayList) or "dictionary" (LinkedHashMap)
  • Loading branch information
melanger committed Jul 20, 2022
1 parent 244ae9e commit d1d19f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
24 changes: 12 additions & 12 deletions config-templates/perun_attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'perunFacilityAttr_voShortNames' => [
'rpc' => 'urn:perun:facility:attribute-def:virt:voShortNames',
'ldap' => 'voShortNames',
'type' => 'map',
'type' => 'array',
],
'perunFacilityAttr_dynamicRegistration' => [
'rpc' => 'urn:perun:facility:attribute-def:def:dynamicRegistration',
Expand Down Expand Up @@ -60,17 +60,17 @@
'perunFacilityAttr_reqAups' => [
'rpc' => 'urn:perun:facility:attribute-def:def:reqAups',
'ldap' => 'requiredAups',
'type' => 'map',
'type' => 'array',
],
'perunFacilityAttr_capabilities' => [
'rpc' => 'urn:perun:facility:attribute-def:def:capabilities',
'ldap' => 'capabilities',
'type' => 'map',
'type' => 'array',
],
'perunFacilityAttr_spname' => [
'rpc' => 'urn:perun:facility:attribute-def:def:serviceName',
'ldap' => 'serviceName',
'type' => 'map',
'type' => 'array',
],

/*
Expand Down Expand Up @@ -150,17 +150,17 @@
'perunUserAttribute_aups' => [
'rpc' => 'urn:perun:user:attribute-def:def:aups',
'ldap' => 'aups',
'type' => 'map',
'type' => 'dictionary',
],
'perunUserAttribute_groupNames' => [
'rpc' => 'urn:perun:user:attribute-def:virt:groupNames',
'ldap' => 'groupNames',
'type' => 'map',
'type' => 'array',
],
'perunUserAttribute_eduPersonEntitlement' => [
'rpc' => 'urn:perun:user:attribute-def:virt:eduPersonEntitlement',
'ldap' => 'eduPersonEntitlement',
'type' => 'map',
'type' => 'array',
],
'perunUserAttribute_entitlement' => [
'rpc' => 'urn:perun:ues:attribute-def:def:entitlement',
Expand All @@ -170,12 +170,12 @@
'perunUserAttribute_bonaFideStatus' => [
'rpc' => 'urn:perun:user:attribute-def:def:bonaFideStatus',
'ldap' => 'bonaFideStatus',
'type' => 'map',
'type' => 'array',
],
'perunUserAttribute_eduPersonScopedAffiliations' => [
'rpc' => 'urn:perun:user:attribute-def:virt:eduPersonScopedAffiliations',
'ldap' => 'eduPersonScopedAffiliations',
'type' => 'map',
'type' => 'array',
],
'perunUserAttribute_affiliation' => [
'rpc' => 'urn:perun:ues:attribute-def:def:affiliation',
Expand All @@ -190,7 +190,7 @@
'perunUserAttribute_eduPersonPrincipalNames' => [
'rpc' => 'urn:perun:user:attribute-def:virt:eduPersonPrincipalNames',
'ldap' => 'eduPersonPrincipalNames',
'type' => 'map',
'type' => 'array',
],
'perunUserAttribute_cesnet' => [
'rpc' => 'urn:perun:user:attribute-def:def:login-namespace:cesnet',
Expand Down Expand Up @@ -230,7 +230,7 @@
'perunGroupAttribute_groupAffiliations' => [
'rpc' => 'urn:perun:group:attribute-def:def:groupAffiliations',
'ldap' => 'groupAffiliations',
'type' => 'map',
'type' => 'array',
],

/*
Expand All @@ -250,6 +250,6 @@
'perunResourceAttribute_capabilities' => [
'rpc' => 'urn:perun:resource:attribute-def:def:capabilities',
'ldap' => 'capabilities',
'type' => 'map',
'type' => 'array',
],
];
7 changes: 2 additions & 5 deletions lib/AdapterLdap.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ class AdapterLdap extends Adapter

public const TYPE_ARRAY = 'array';

//TODO: remove in future major release and replace with self::TYPE_ARRAY
public const TYPE_MAP = 'map';

public const TYPE_DICTIONARY = 'dictionary';

public const INTERNAL_ATTR_NAME = 'internalAttrName';
Expand Down Expand Up @@ -651,13 +648,13 @@ private function resolveAttrValue($attrsNameTypeMap, $attrsFromLdap, $attr)
if ($attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_BOOL) {
return false;
}
if ($attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_MAP
if ($attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_ARRAY
|| $attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_DICTIONARY
) {
return [];
}
} else {
if ($attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_MAP) {
if ($attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_ARRAY) {
return $attrsFromLdap[$attr];
}
if ($attrsNameTypeMap[$attr][self::TYPE] === self::TYPE_DICTIONARY) {
Expand Down

0 comments on commit d1d19f1

Please sign in to comment.