From dc1984eb4c848670b6f6bd6b4376047296362b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Thu, 17 Oct 2024 00:33:47 +0200 Subject: [PATCH] Dalsi oprava Auth --- .gitlab-ci.yml | 2 +- lib/CF2022/Helpers/Auth.pm | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 073b10f..e9e74a6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ image: docker:latest variables: DOCKER_TLS_CERTDIR: "/certs" - IMAGE_VER: 0.21.4 + IMAGE_VER: 0.21.5 services: - docker:dind diff --git a/lib/CF2022/Helpers/Auth.pm b/lib/CF2022/Helpers/Auth.pm index 1a70b95..45b0cb2 100644 --- a/lib/CF2022/Helpers/Auth.pm +++ b/lib/CF2022/Helpers/Auth.pm @@ -76,6 +76,7 @@ sub register ( $class, $self, $conf) { $self->helper( oauth_main_group => sub ( $c ) { my $claims = $c->oauth_claims // return; + my $cen_regp; GROUP: foreach my $group ( sort @{ $claims->{groups} } ) { @@ -90,13 +91,18 @@ sub register ( $class, $self, $conf) { role => $role, }; } - elsif ( $group =~ /cen:regp/ ) { - return { - region => '', - role => 'regp', - }; + if ( $group =~ /cen:regp/ ) { + $cen_regp = 1; } } + + if ( $cen_regp ) { + return { + region => 'Praha', + role => 'regp', + }; + } + }); $self->helper( user => sub ( $c ) { -- GitLab