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):
594594
595595 # Try to fill in the DiracX section
596596 if self .useIAM :
597- iam_subs = self .iamSrv .getUsersSub ()
597+ iam_subs = self .iamSrv .getUsersSub (self . vo )
598598 diracx_vo_config = {"DiracX" : {"CsSync" : {"VOs" : {self .vo : {"UserSubjects" : iam_subs }}}}}
599599 iam_sub_cfg = CFG ()
600600 iam_sub_cfg .loadFromDict (diracx_vo_config )
Original file line number Diff line number Diff line change @@ -144,14 +144,15 @@ def getUsers(self):
144144 result = S_OK ({"Users" : users , "Errors" : errors })
145145 return result
146146
147- def getUsersSub (self ) -> dict [str , str ]:
147+ def getUsersSub (self , vo = None ) -> dict [str , str ]:
148148 """
149149 Return the mapping based on IAM sub:
150150 {nickname : sub}
151151 """
152152 iam_users_raw = self ._getIamUserDump ()
153153 diracx_user_section = {}
154154 for user_info in iam_users_raw :
155+ userGroups = [grp ["display" ] for grp in user_info .get ("groups" , [])]
155156 # The nickname is available in the list of attributes
156157 # (if configured so)
157158 # in the form {'name': 'nickname', 'value': 'chaen'}
@@ -165,8 +166,8 @@ def getUsersSub(self) -> dict[str, str]:
165166 except (KeyError , IndexError ):
166167 nickname = user_info ["userName" ]
167168 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
170171 # reorder it
171172 diracx_user_section = dict (sorted (diracx_user_section .items ()))
172173
You can’t perform that action at this time.
0 commit comments