diff --git a/util/sso/__init__.py b/util/sso/__init__.py index cd743c7..853d9c8 100644 --- a/util/sso/__init__.py +++ b/util/sso/__init__.py @@ -1,5 +1,5 @@ from conf import CONFIG -from util.sso.c3hub import get_c3hub_userid, get_c3hub_username +from util.sso.c3hub import check_c3hub_no_limit, get_c3hub_userid, get_c3hub_username from util.sso.c3voc import ( check_c3voc_allowed_login, check_c3voc_is_admin, @@ -26,7 +26,7 @@ "functions": { "is_admin": lambda json: False, "login_allowed": lambda json: True, - "no_limit": lambda json: False, + "no_limit": check_c3hub_no_limit, "userid": get_c3hub_userid, "username": get_c3hub_username, }, diff --git a/util/sso/c3hub.py b/util/sso/c3hub.py index 5000f55..055a803 100644 --- a/util/sso/c3hub.py +++ b/util/sso/c3hub.py @@ -4,3 +4,7 @@ def get_c3hub_userid(userinfo_json): def get_c3hub_username(userinfo_json): return "{} (38C3)".format(userinfo_json["username"]) + + +def check_c3hub_no_limit(userinfo_json): + return f"c3hub:{userinfo_json['username'].lower()}" in CONFIG["NO_LIMIT_USERS"]