Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
02e1871f
Commit
02e1871f
authored
3 years ago
by
pabois
Browse files
Options
Downloads
Patches
Plain Diff
roles names
parent
7c81d8f6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/server/application_controller.rb
+3
-3
3 additions, 3 deletions
app/controllers/server/application_controller.rb
app/models/ability.rb
+1
-1
1 addition, 1 deletion
app/models/ability.rb
app/models/user/with_authentication.rb
+1
-1
1 addition, 1 deletion
app/models/user/with_authentication.rb
with
5 additions
and
5 deletions
app/controllers/server/application_controller.rb
+
3
−
3
View file @
02e1871f
class
Server::ApplicationController
<
ApplicationController
layout
'server/layouts/application'
before_action
:authenticate_user!
,
:ensure_user_if_s
up
eradmin
before_action
:authenticate_user!
,
:ensure_user_if_ser
ver_
admin
protected
...
...
@@ -9,7 +9,7 @@ class Server::ApplicationController < ApplicationController
add_breadcrumb
'Tableau de bord'
,
:server_root_path
end
def
ensure_user_if_s
up
eradmin
raise
CanCan
::
AccessDenied
unless
current_user
.
s
up
eradmin?
def
ensure_user_if_ser
ver_
admin
raise
CanCan
::
AccessDenied
unless
current_user
.
ser
ver_
admin?
end
end
This diff is collapsed.
Click to expand it.
app/models/ability.rb
+
1
−
1
View file @
02e1871f
...
...
@@ -45,7 +45,7 @@ class Ability
can
:manage
,
User
,
university_id:
@user
.
university_id
,
role:
@user
.
managed_roles
end
def
s
up
eradmin
def
ser
ver_
admin
can
:manage
,
:all
end
end
This diff is collapsed.
Click to expand it.
app/models/user/with_authentication.rb
+
1
−
1
View file @
02e1871f
...
...
@@ -74,7 +74,7 @@ module User::WithAuthentication
def
set_default_role
if
User
.
all
.
empty?
role
=
:s
up
eradmin
role
=
:ser
ver_
admin
elsif
university
.
users
.
empty?
role
=
:admin
else
...
...
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