File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
ConfigurationSystem/Client Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -594,7 +594,7 @@ def syncCSWithVOMS(self):
594
594
595
595
# Try to fill in the DiracX section
596
596
if self .useIAM :
597
- iam_subs = self .iamSrv .getUsersSub ()
597
+ iam_subs = self .iamSrv .getUsersSub (self . vo )
598
598
diracx_vo_config = {"DiracX" : {"CsSync" : {"VOs" : {self .vo : {"UserSubjects" : iam_subs }}}}}
599
599
iam_sub_cfg = CFG ()
600
600
iam_sub_cfg .loadFromDict (diracx_vo_config )
Original file line number Diff line number Diff line change @@ -144,14 +144,15 @@ def getUsers(self):
144
144
result = S_OK ({"Users" : users , "Errors" : errors })
145
145
return result
146
146
147
- def getUsersSub (self ) -> dict [str , str ]:
147
+ def getUsersSub (self , vo = None ) -> dict [str , str ]:
148
148
"""
149
149
Return the mapping based on IAM sub:
150
150
{nickname : sub}
151
151
"""
152
152
iam_users_raw = self ._getIamUserDump ()
153
153
diracx_user_section = {}
154
154
for user_info in iam_users_raw :
155
+ userGroups = [grp ["display" ] for grp in user_info .get ("groups" , [])]
155
156
# The nickname is available in the list of attributes
156
157
# (if configured so)
157
158
# in the form {'name': 'nickname', 'value': 'chaen'}
@@ -165,8 +166,8 @@ def getUsersSub(self) -> dict[str, str]:
165
166
except (KeyError , IndexError ):
166
167
nickname = user_info ["userName" ]
167
168
sub = user_info ["id" ]
168
-
169
- diracx_user_section [nickname ] = sub
169
+ if not vo or vo in userGroups :
170
+ diracx_user_section [nickname ] = sub
170
171
# reorder it
171
172
diracx_user_section = dict (sorted (diracx_user_section .items ()))
172
173
You can’t perform that action at this time.
0 commit comments