Skip to content
Snippets Groups Projects
Verified Commit 6b663355 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Umozneno lokalni mapovani skupin na role

parent f59b2a57
Branches
No related tags found
No related merge requests found
Pipeline #1995 passed
...@@ -3,7 +3,7 @@ image: docker:19.03.1 ...@@ -3,7 +3,7 @@ image: docker:19.03.1
variables: variables:
DOCKER_TLS_CERTDIR: "/certs" DOCKER_TLS_CERTDIR: "/certs"
IMAGE_TAG: $CI_REGISTRY_IMAGE IMAGE_TAG: $CI_REGISTRY_IMAGE
IMAGE_VER: 1.7.0 IMAGE_VER: 1.8.0
services: services:
- docker:19.03.1-dind - docker:19.03.1-dind
......
...@@ -94,9 +94,23 @@ sub register ( $class, $self, $conf) { ...@@ -94,9 +94,23 @@ sub register ( $class, $self, $conf) {
@roles = split /\W+/, $c->req->headers('X-Roles'); @roles = split /\W+/, $c->req->headers('X-Roles');
} }
elsif ( my $claims = $c->oauth_claims ) { elsif ( my $claims = $c->oauth_claims ) {
@roles = @{ $claims->{roles} // [] };
if ( $c->cfg->{groups_to_roles_map} ) {
GROUP:
foreach my $group ( sort @{ $claims->{groups} } ) {
if ($c->cfg->{groups_to_roles_map} =~ /$group=(\w+)/x) {
push @roles, $1;
}
}
}
else {
@roles = @{ $claims->{roles} // [] };
}
} }
$c->trace(join '=', @roles);
$c->stash->{user_roles} //= { map { $_ => 1 } @roles }; $c->stash->{user_roles} //= { map { $_ => 1 } @roles };
return $c->stash->{user_roles}; return $c->stash->{user_roles};
}); });
......
openapi: 3.0.3 openapi: 3.0.3
info: info:
version: 1.7.0 version: 1.8.0
title: CF Online title: CF Online
description: CF Online description: CF Online
license: license:
...@@ -124,6 +124,7 @@ components: ...@@ -124,6 +124,7 @@ components:
type: string type: string
jitsi_url: jitsi_url:
type: string type: string
nullable: true
is_banned: is_banned:
type: boolean type: boolean
Announcement: Announcement:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment