Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ELC_elections
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gestion-des-assemblees
ELC_elections
Commits
c7d4275f
Commit
c7d4275f
authored
4 years ago
by
Alexis Poyen
Browse files
Options
Downloads
Patches
Plain Diff
Feat : Handle users for election
parent
67fde387
No related branches found
No related tags found
1 merge request
!3
Feat : Handle users for election
Pipeline
#5275
passed
4 years ago
Stage: sonar-analysis
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.env
+1
-1
1 addition, 1 deletion
.env
internal/auth/oauth2.go
+2
-2
2 additions, 2 deletions
internal/auth/oauth2.go
with
3 additions
and
3 deletions
.env
+
1
−
1
View file @
c7d4275f
HOSTNAME=elections.127.0.0.1.nip.io
HOSTNAME=elections.127.0.0.1.nip.io
ADMIN_GROUP=ADMINS
ADMIN_GROUP=ADMINS
CLIENT
_GROUP=VISUALIZER
VISUALIZER
_GROUP=VISUALIZER
# Needed to user OAuth2 authentication :
# Needed to user OAuth2 authentication :
REDIRECT_URL=https://${HOSTNAME}/OAuth2Callback
REDIRECT_URL=https://${HOSTNAME}/OAuth2Callback
...
...
This diff is collapsed.
Click to expand it.
internal/auth/oauth2.go
+
2
−
2
View file @
c7d4275f
...
@@ -163,8 +163,8 @@ func (d *DataHandler) addUserInMemory(userOauth2 UserOAuth2) (User, error) {
...
@@ -163,8 +163,8 @@ func (d *DataHandler) addUserInMemory(userOauth2 UserOAuth2) (User, error) {
for
_
,
userRole
:=
range
userOauth2
.
Groups
{
for
_
,
userRole
:=
range
userOauth2
.
Groups
{
if
userRole
!=
""
&&
(
userRole
==
os
.
Getenv
(
"ADMIN_GROUP"
))
{
if
userRole
!=
""
&&
(
userRole
==
os
.
Getenv
(
"ADMIN_GROUP"
))
{
user
.
Role
=
"ADMIN"
user
.
Role
=
"ADMIN"
}
else
if
userRole
!=
""
&&
(
userRole
==
os
.
Getenv
(
"
CLIENT
_GROUP"
))
{
}
else
if
userRole
!=
""
&&
(
userRole
==
os
.
Getenv
(
"
VISUALIZER
_GROUP"
))
{
user
.
Role
=
"
CLIENT
"
user
.
Role
=
"
VISUALIZER
"
}
else
{
}
else
{
return
user
,
errors
.
New
(
"user not in an app group"
)
return
user
,
errors
.
New
(
"user not in an app group"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment