Skip to content

Commit 423183d

Browse files
slyngshedenijel
authored andcommitted
CAS: better test coverage and formatting
1 parent dea510c commit 423183d

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

social_core/backends/cas.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,7 @@ def get_user_details(self, response):
6262
}
6363

6464
def auth_allowed(self, response, details):
65-
if not super().auth_allowed(response, details):
66-
return False
67-
68-
allow_groups = self.setting("ALLOW_GROUPS", [])
69-
if not allow_groups:
70-
return True
71-
72-
groups = response.get("groups", [])
73-
for group in groups:
74-
if group in allow_groups:
75-
return True
76-
return False
65+
allow_groups = set(self.setting("ALLOW_GROUPS", set()))
66+
groups = set(response.get("groups", set()))
67+
return super().auth_allowed(response, details) if groups.intersection(allow_groups) or \
68+
not allow_groups else False

0 commit comments

Comments
 (0)