From 912f77036c335a856b6b44ad9f27cd64039a9851 Mon Sep 17 00:00:00 2001 From: floriandeboissieu Date: Sat, 5 Nov 2022 03:06:00 +0100 Subject: [PATCH 1/3] possible fix to unionize allowed lists --- oauthenticator/gitlab.py | 1 + 1 file changed, 1 insertion(+) diff --git a/oauthenticator/gitlab.py b/oauthenticator/gitlab.py index bad1d04f..2e141889 100644 --- a/oauthenticator/gitlab.py +++ b/oauthenticator/gitlab.py @@ -184,6 +184,7 @@ async def authenticate(self, handler, data=None): or (is_project_id_specified and user_in_project) or no_config_specified ): + self.allowed_users.add(username) return { 'name': username, 'auth_state': {'access_token': access_token, 'gitlab_user': resp_json}, From 0b0af036b7ff777db40384ef78c38951a4c43d67 Mon Sep 17 00:00:00 2001 From: floriandeboissieu Date: Thu, 8 Jun 2023 03:22:45 +0200 Subject: [PATCH 2/3] Update gitlab.py fix case of no_config_specified: let authenticator decide --- oauthenticator/gitlab.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oauthenticator/gitlab.py b/oauthenticator/gitlab.py index 2e141889..da1349a4 100644 --- a/oauthenticator/gitlab.py +++ b/oauthenticator/gitlab.py @@ -179,12 +179,17 @@ async def authenticate(self, handler, data=None): no_config_specified = not (is_group_specified or is_project_id_specified) + if ( + (is_group_specified and user_in_group) + or (is_project_id_specified and user_in_project) + ): + self.allowed_users.add(username) + if ( (is_group_specified and user_in_group) or (is_project_id_specified and user_in_project) or no_config_specified ): - self.allowed_users.add(username) return { 'name': username, 'auth_state': {'access_token': access_token, 'gitlab_user': resp_json}, From d563163e8a4da84b2f38d8991fa8e27b197319c9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 01:23:13 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- oauthenticator/gitlab.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/oauthenticator/gitlab.py b/oauthenticator/gitlab.py index da1349a4..a8c398a8 100644 --- a/oauthenticator/gitlab.py +++ b/oauthenticator/gitlab.py @@ -179,12 +179,11 @@ async def authenticate(self, handler, data=None): no_config_specified = not (is_group_specified or is_project_id_specified) - if ( - (is_group_specified and user_in_group) - or (is_project_id_specified and user_in_project) + if (is_group_specified and user_in_group) or ( + is_project_id_specified and user_in_project ): - self.allowed_users.add(username) - + self.allowed_users.add(username) + if ( (is_group_specified and user_in_group) or (is_project_id_specified and user_in_project)