Skip to content

Commit db53d4d

Browse files
authored
Change "FLAGS_BY_GROUP" in backends.py to accept array of groups
This commit changes the logic of the "FLAGS_BY_GROUP" parameter such that it can accept an array of group names. This will allow multiple groups to be configured with the respective flag.
1 parent 2a9ed4b commit db53d4d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

django3_saml2_nbplugin/backends.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ def configure_user(self, request: WSGIRequest, user: User) -> User:
171171
pass
172172

173173
if "FLAGS_BY_GROUP" in be_settings and "GROUP_ATTR" in be_settings:
174-
for flag, group_name in be_settings["FLAGS_BY_GROUP"].items():
175-
if group_name in ident_groups:
174+
for flag, group_names in be_settings["FLAGS_BY_GROUP"].items():
175+
if not isinstance(group_names, list):
176+
group_names = [group_names]
177+
if any(group_name in ident_groups for group_name in group_names):
176178
setattr(user, flag, True)
177179
else:
178180
setattr(user, flag, False)

0 commit comments

Comments
 (0)