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

Commit 79f40a3

Browse files
Merge pull request #107 from BaranekD/LDAP
New way of reading attrs, LDAP methods implementing
2 parents a60b1fa + 2303563 commit 79f40a3

File tree

11 files changed

+589
-108
lines changed

11 files changed

+589
-108
lines changed

CHANGELOG.md

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

44
## [Unreleased]
5+
#### Added
6+
- Added some methods for getting values to Adapter.php
7+
- Added fallback to RPC for methods we're not able to run in LDAP
8+
59
#### Changed
10+
- Changed the way of getting attribute names for interfaces: through internal attribute names in perun_attributes.php config
611
- Return sorted eduPersonEntitlement
712

813
## [v3.9.0]
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
<?php
2+
3+
$config = [
4+
5+
/*
6+
* FACILITY ATTRIBUTES
7+
*/
8+
9+
'perunFacilityAttr_checkGroupMembership' => [
10+
'rpc' => 'urn:perun:facility:attribute-def:def:checkGroupMembership',
11+
'ldap' => 'checkGroupMembership',
12+
'type' => 'bool'
13+
],
14+
'perunFacilityAttr_voShortNames' => [
15+
'rpc' => 'urn:perun:facility:attribute-def:virt:voShortNames',
16+
'ldap' => 'voShortNames',
17+
'type' => 'map'
18+
],
19+
'perunFacilityAttr_dynamicRegistration' => [
20+
'rpc' => 'urn:perun:facility:attribute-def:def:dynamicRegistration',
21+
'ldap' => 'dynamicRegistration',
22+
'type' => 'bool'
23+
],
24+
'perunFacilityAttr_OIDCClientID' => [
25+
'rpc' => 'urn:perun:facility:attribute-def:def:OIDCClientID',
26+
'ldap' => 'OIDCClientID',
27+
'type' => 'string'
28+
],
29+
'perunFacilityAttr_registerUrl' => [
30+
'rpc' => 'urn:perun:facility:attribute-def:def:registerUrl',
31+
'ldap' => 'registrationURL',
32+
'type' => 'string'
33+
],
34+
'perunFacilityAttr_allowRegistration' => [
35+
'rpc' => 'urn:perun:facility:attribute-def:def:allowRegistration',
36+
'ldap' => 'allowRegistration',
37+
'type' => 'bool'
38+
],
39+
'perunFacilityAttr_registrationURL' => [
40+
'rpc' => 'urn:perun:facility:attribute-def:def:registrationURL',
41+
'ldap' => 'registrationURL',
42+
'type' => 'string'
43+
],
44+
'perunFacilityAttr_wayfFilter' => [
45+
'rpc' => 'urn:perun:facility:attribute-def:def:wayfFilter',
46+
'ldap' => 'wayfFilter',
47+
'type' => 'string'
48+
],
49+
'perunFacilityAttr_wayfEFilter' => [
50+
'rpc' => 'urn:perun:facility:attribute-def:def:wayfEFilter',
51+
'ldap' => 'wayfEFilter',
52+
'type' => 'string'
53+
],
54+
'perunFacilityAttr_reqAups' => [
55+
'rpc' => 'urn:perun:facility:attribute-def:def:reqAups',
56+
'ldap' => 'requiredAups',
57+
'type' => 'map'
58+
],
59+
'perunFacilityAttr_capabilities' => [
60+
'rpc' => 'urn:perun:facility:attribute-def:def:capabilities',
61+
'ldap' => 'capabilities',
62+
'type' => 'map'
63+
],
64+
65+
/*
66+
* USER ATTRIBUTES
67+
*/
68+
69+
'perunUserAttribute_einfraid-persistent' => [
70+
'rpc' => 'urn:perun:user:attribute-def:virt:login-namespace:einfraid-persistent',
71+
'ldap' => 'einfraid-persistent',
72+
'type' => 'bool'
73+
],
74+
'perunUserAttribute_einfra' => [
75+
'rpc' => 'urn:perun:user:attribute-def:def:login-namespace:einfra',
76+
'ldap' => 'einfra',
77+
'type' => 'bool'
78+
],
79+
'perunUserAttribute_id' => [
80+
'rpc' => 'urn:perun:user:attribute-def:core:id',
81+
'ldap' => 'perunUserId',
82+
'type' => 'integer'
83+
],
84+
'perunUserAttribute_firstName' => [
85+
'rpc' => 'urn:perun:user:attribute-def:core:firstName',
86+
'ldap' => 'firstName',
87+
'type' => 'string'
88+
],
89+
'perunUserAttribute_middleName' => [
90+
'rpc' => 'urn:perun:user:attribute-def:core:middleName',
91+
'ldap' => 'middleName',
92+
'type' => 'string'
93+
],
94+
'perunUserAttribute_lastName' => [
95+
'rpc' => 'urn:perun:user:attribute-def:core:lastName',
96+
'ldap' => 'lastName',
97+
'type' => 'string'
98+
],
99+
'perunUserAttribute_cn' => [
100+
'rpc' => 'urn:perun:ues:attribute-def:def:cn',
101+
'ldap' => 'cn',
102+
'type' => 'string'
103+
],
104+
'perunUserAttribute_displayName' => [
105+
'rpc' => 'urn:perun:ues:attribute-def:def:displayName',
106+
'ldap' => 'displayName',
107+
'type' => 'string'
108+
],
109+
'perunUserAttribute_mail' => [
110+
'rpc' => 'urn:perun:ues:attribute-def:def:mail',
111+
'ldap' => 'mail',
112+
'type' => 'string'
113+
],
114+
'perunUserAttribute_timezone' => [
115+
'rpc' => 'urn:perun:user:attribute-def:def:timezone',
116+
'ldap' => 'timezone',
117+
'type' => 'string'
118+
],
119+
'perunUserAttribute_preferredLanguage' => [
120+
'rpc' => 'urn:perun:user:attribute-def:def:preferredLanguage',
121+
'ldap' => 'preferredLanguage',
122+
'type' => 'string'
123+
],
124+
'perunUserAttribute_preferredMail' => [
125+
'rpc' => 'urn:perun:user:attribute-def:def:preferredMail',
126+
'ldap' => 'preferredMail',
127+
'type' => 'string'
128+
],
129+
'perunUserAttribute_phone' => [
130+
'rpc' => 'urn:perun:user:attribute-def:def:phone',
131+
'ldap' => 'phone',
132+
'type' => 'string'
133+
],
134+
'perunUserAttribute_address' => [
135+
'rpc' => 'urn:perun:user:attribute-def:def:address',
136+
'ldap' => 'address',
137+
'type' => 'string'
138+
],
139+
'perunUserAttribute_aups' => [
140+
'rpc' => 'urn:perun:user:attribute-def:def:aups',
141+
'ldap' => 'aups',
142+
'type' => 'map'
143+
],
144+
'perunUserAttribute_groupNames' => [
145+
'rpc' => 'urn:perun:user:attribute-def:virt:groupNames',
146+
'ldap' => 'groupNames',
147+
'type' => 'map'
148+
],
149+
'perunUserAttribute_eduPersonEntitlement' => [
150+
'rpc' => 'urn:perun:user:attribute-def:virt:eduPersonEntitlement',
151+
'ldap' => 'eduPersonEntitlement',
152+
'type' => 'map'
153+
],
154+
'perunUserAttribute_entitlement' => [
155+
'rpc' => 'urn:perun:ues:attribute-def:def:entitlement',
156+
'ldap' => 'eduPersonEntitlement',
157+
'type' => 'string'
158+
],
159+
'perunUserAttribute_bonaFideStatus' => [
160+
'rpc' => 'urn:perun:user:attribute-def:def:bonaFideStatus',
161+
'ldap' => 'bonaFideStatus',
162+
'type' => 'map'
163+
],
164+
'perunUserAttribute_eduPersonScopedAffiliations' => [
165+
'rpc' => 'urn:perun:user:attribute-def:virt:eduPersonScopedAffiliations',
166+
'ldap' => 'eduPersonScopedAffiliations',
167+
'type' => 'map'
168+
],
169+
'perunUserAttribute_affiliation' => [
170+
'rpc' => 'urn:perun:ues:attribute-def:def:affiliation',
171+
'ldap' => '',
172+
'type' => 'string'
173+
],
174+
'perunUserAttribute_isCesnetEligibleLastSeen' => [
175+
'rpc' => 'urn:perun:user:attribute-def:def:isCesnetEligibleLastSeen',
176+
'ldap' => 'isCesnetEligibleLastSeen',
177+
'type' => 'string'
178+
],
179+
'perunUserAttribute_eduPersonPrincipalNames' => [
180+
'rpc' => 'urn:perun:user:attribute-def:virt:eduPersonPrincipalNames',
181+
'ldap' => 'eduPersonPrincipalNames',
182+
'type' => 'map'
183+
],
184+
'perunUserAttribute_cesnet' => [
185+
'rpc' => 'urn:perun:user:attribute-def:def:login-namespace:cesnet',
186+
'ldap' => 'login;x-ns-einfra',
187+
'type' => 'string'
188+
],
189+
'perunUserAttribute_einfraid-persistent-shadow' => [
190+
'rpc' => 'urn:perun:user:attribute-def:def:login-namespace:einfraid-persistent-shadow',
191+
'ldap' => 'login;x-ns-einfraid-persistent-shadow',
192+
'type' => 'string'
193+
],
194+
'perunUserAttribute_o' => [
195+
'rpc' => 'urn:perun:ues:attribute-def:def:o',
196+
'ldap' => 'o',
197+
'type' => 'string'
198+
],
199+
'perunUserAttribute_givenName' => [
200+
'rpc' => 'urn:perun:ues:attribute-def:def:givenName',
201+
'ldap' => 'givenName',
202+
'type' => 'string'
203+
],
204+
'perunUserAttribute_sn' => [
205+
'rpc' => 'urn:perun:ues:attribute-def:def:sn',
206+
'ldap' => 'sn',
207+
'type' => 'String'
208+
],
209+
'perunUserAttribute_loa' => [
210+
'rpc' => 'urn:perun:user:attribute-def:virt:loa',
211+
'ldap' => 'loa',
212+
'type' => 'integer'
213+
],
214+
215+
/*
216+
* GROUP ATTRIBUTES
217+
*/
218+
219+
'perunGroupAttribute_groupAffiliations' => [
220+
'rpc' => 'urn:perun:group:attribute-def:def:groupAffiliations',
221+
'ldap' => 'groupAffiliations',
222+
'type' => 'map'
223+
],
224+
225+
/*
226+
* VO ATTRIBUTES
227+
*/
228+
229+
'perunVoAttribute_aup' => [
230+
'rpc' => 'urn:perun:vo:attribute-def:def:aup',
231+
'ldap' => 'aup',
232+
'type' => 'string'
233+
],
234+
235+
/*
236+
* RESOURCE ATTRIBUTES
237+
*/
238+
239+
'perunResourceAttribute_capabilities' => [
240+
'rpc' => 'urn:perun:resource:attribute-def:def:capabilities',
241+
'ldap' => 'capabilities',
242+
'type' => 'map'
243+
]
244+
];

lib/Adapter.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,17 @@ abstract public function getSpGroups($spEntityId);
9292
/**
9393
* @param User $user
9494
* @param array $attrNames .
95-
* @return array associative of attributes. Keys are attribute names
96-
* and values are attr values (can be null, string, array, associative array)
95+
* @return array of attribute name -> attribute
9796
*/
9897
abstract public function getUserAttributes($user, $attrNames);
9998

99+
/**
100+
* @param User $user
101+
* @param array $attributes of internal attribute names
102+
* @return array of attribute name -> attribute value
103+
*/
104+
abstract public function getUserAttributesValues($user, $attributes);
105+
100106
/**
101107
* @param string $attrName
102108
* @return map of all entityless attributes with attrName (for all namespaces of same attribute).
@@ -106,11 +112,17 @@ abstract public function getEntitylessAttribute($attrName);
106112
/**
107113
* @param Vo $vo
108114
* @param array $attrNames
109-
* @return array associative of attributes. Keys are attribute names
110-
* and values are attr values (can be null, string, array, associative array)* @return
115+
* @return array of attribute name -> attribute
111116
*/
112117
abstract public function getVoAttributes($vo, $attrNames);
113118

119+
/**
120+
* @param Vo $vo
121+
* @param array $attributes of internal attribute names
122+
* @return array of attribute name -> attribute value
123+
*/
124+
abstract public function getVoAttributesValues($vo, $attributes);
125+
114126
/**
115127
* @param Facility $facility
116128
* @param string $attrName
@@ -146,10 +158,10 @@ abstract public function getFacilityAttributes($facility, $attrNames);
146158

147159
/**
148160
* @param Facility $facility
149-
* @param $attrNames array string $attrNames
161+
* @param $attributes array of internal attribute names
150162
* @return array of attribute name -> attribute value
151163
*/
152-
abstract public function getFacilityAttributesValues($facility, $attrNames);
164+
abstract public function getFacilityAttributesValues($facility, $attributes);
153165

154166
/**
155167
* @param $extSourceName string name of ext source

0 commit comments

Comments
 (0)