Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/DIRAC/ConfigurationSystem/Client/CSAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,19 @@ def __describeEntity(self, mask, hosts=False):
if "Users" in groupsDict[group] and entity in groupsDict[group]["Users"]:
entitiesDict[entity]["Groups"].append(group)
entitiesDict[entity]["Groups"].sort()
entitiesDict[entity]["AffiliationEnds"] = self.getUserAffiliationEnds(entity)
return S_OK(entitiesDict)

def getUserAffiliationEnds(self, nick):
affiliation_ends_current = {}
csSection = f"{self.__baseSecurity}/Users/{nick}/"
user_sections = self.__csMod.getSections(csSection)
if "AffiliationEnds" in user_sections:
affiliation_ends_opts = self.__csMod.getOptions(f"{csSection}/AffiliationEnds")
for vo_ in affiliation_ends_opts:
affiliation_ends_current[vo_] = self.__csMod.getValue(f"{csSection}/AffiliationEnds/{vo_}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just use

def getOptionsDict(self, sectionPath):

Construct the whole path and call getOptionsDict

# getOptionsDict returns S_ERROR if missing section
return self.__csMod.getOptionsDict(f"{theSections}").get("Value", {})

Copy link
Contributor Author

@ryuwd ryuwd Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it seems that getOptionsDict is the right option here, but I can't be sure that it'll work as expected (particularly since it doesn't seem to return S_ERROR on missing section)

I will integrate it when I have time, but I don't currently trust it and this shouldn't block the next release, since there is a hotfix that depends on this PR

return affiliation_ends_current

def listGroups(self):
"""
List all groups
Expand Down
Loading