Skip to content

Commit 84c6a76

Browse files
committed
fix: return first request group straight away
1 parent cd98233 commit 84c6a76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DIRAC/FrameworkSystem/API/AuthHandler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,10 @@ def __researchDIRACGroup(self, extSession, chooseScope, state):
437437
provider = firstRequest.provider
438438
self.log.debug("The following groups found", f"for {username}: {', '.join(firstRequest.groups)}")
439439

440+
# If group is already defined in the first request, just return it as it was already validated
441+
if firstRequest.groups:
442+
return extSession["authed"], firstRequest
443+
440444
# Look for DIRAC groups valid for the user
441445
result = getGroupsForUser(username)
442446
if not result["OK"]:
@@ -460,10 +464,6 @@ def __researchDIRACGroup(self, extSession, chooseScope, state):
460464

461465
self.log.debug(f"The state of {username} user groups has been checked:", pprint.pformat(validGroups))
462466

463-
# If group already defined in first request, just return it
464-
if firstRequest.groups:
465-
return extSession["authed"], firstRequest
466-
467467
# If not and we found only one valid group, apply this group
468468
if len(validGroups) == 1:
469469
firstRequest.addScopes([f"g:{validGroups[0]}"])

0 commit comments

Comments
 (0)