Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
426680de
Commit
426680de
authored
Feb 06, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of the frontend view, including tests
parent
54ff60f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
8 deletions
+29
-8
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+1
-1
app/models/user.rb
app/models/user.rb
+15
-0
app/views/admin/users/_access_levels.html.haml
app/views/admin/users/_access_levels.html.haml
+12
-6
spec/features/admin/admin_users_spec.rb
spec/features/admin/admin_users_spec.rb
+1
-1
No files found.
app/controllers/admin/users_controller.rb
View file @
426680de
...
@@ -175,7 +175,7 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -175,7 +175,7 @@ class Admin::UsersController < Admin::ApplicationController
def
user_params_ce
def
user_params_ce
[
[
:a
dmin
,
:a
ccess_level
,
:avatar
,
:avatar
,
:bio
,
:bio
,
:can_create_group
,
:can_create_group
,
...
...
app/models/user.rb
View file @
426680de
...
@@ -903,6 +903,21 @@ class User < ActiveRecord::Base
...
@@ -903,6 +903,21 @@ class User < ActiveRecord::Base
end
end
end
end
def
access_level
if
admin?
:admin
else
:regular
end
end
def
access_level
=
(
new_level
)
new_level
=
new_level
.
to_s
return
unless
%w(admin regular)
.
include?
(
new_level
)
self
.
admin
=
(
new_level
==
'admin'
)
end
private
private
def
ci_projects_union
def
ci_projects_union
...
...
app/views/admin/users/_access_levels.html.haml
View file @
426680de
...
@@ -9,12 +9,18 @@
...
@@ -9,12 +9,18 @@
.col-sm-10
=
f
.
check_box
:can_create_group
.col-sm-10
=
f
.
check_box
:can_create_group
.form-group
.form-group
=
f
.
label
:admin
,
class:
'control-label'
=
f
.
label
:access_level
,
class:
'control-label'
-
if
current_user
==
@user
.col-sm-10
.col-sm-10
=
f
.
check_box
:admin
,
disabled:
true
=
f
.
radio_button
:access_level
,
:regular
,
disabled:
(
current_user
==
@user
&&
@user
.
is_admin?
)
.col-sm-10
You cannot remove your own admin rights.
=
label_tag
:regular
do
-
else
Regular
.col-sm-10
=
f
.
check_box
:admin
%p
.light
Regular users have access to their groups and projects
=
f
.
radio_button
:access_level
,
:admin
=
label_tag
:admin
do
Admin
%p
.light
Administrators have access to all groups, projects and users and can manage all features in this installation
.form-group
.form-group
=
f
.
label
:external
,
class:
'control-label'
=
f
.
label
:external
,
class:
'control-label'
...
...
spec/features/admin/admin_users_spec.rb
View file @
426680de
...
@@ -211,7 +211,7 @@ describe "Admin::Users", feature: true do
...
@@ -211,7 +211,7 @@ describe "Admin::Users", feature: true do
fill_in
"user_email"
,
with:
"bigbang@mail.com"
fill_in
"user_email"
,
with:
"bigbang@mail.com"
fill_in
"user_password"
,
with:
"AValidPassword1"
fill_in
"user_password"
,
with:
"AValidPassword1"
fill_in
"user_password_confirmation"
,
with:
"AValidPassword1"
fill_in
"user_password_confirmation"
,
with:
"AValidPassword1"
ch
eck
"user
_admin"
ch
oose
"user_access_level
_admin"
click_button
"Save changes"
click_button
"Save changes"
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment