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
Boxiang Sun
gitlab-ce
Commits
cc04c5b8
Commit
cc04c5b8
authored
Jun 22, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor admin user page
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
b2139093
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
245 additions
and
235 deletions
+245
-235
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+10
-1
app/views/admin/identities/index.html.haml
app/views/admin/identities/index.html.haml
+2
-4
app/views/admin/users/_head.html.haml
app/views/admin/users/_head.html.haml
+23
-0
app/views/admin/users/groups.html.haml
app/views/admin/users/groups.html.haml
+19
-0
app/views/admin/users/keys.html.haml
app/views/admin/users/keys.html.haml
+3
-0
app/views/admin/users/projects.html.haml
app/views/admin/users/projects.html.haml
+43
-0
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+142
-230
config/routes.rb
config/routes.rb
+3
-0
No files found.
app/controllers/admin/users_controller.rb
View file @
cc04c5b8
class
Admin::UsersController
<
Admin
::
ApplicationController
class
Admin::UsersController
<
Admin
::
ApplicationController
before_action
:user
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:user
,
except:
[
:index
,
:new
,
:create
]
def
index
def
index
@users
=
User
.
order_name_asc
.
filter
(
params
[
:filter
])
@users
=
User
.
order_name_asc
.
filter
(
params
[
:filter
])
...
@@ -9,8 +9,17 @@ class Admin::UsersController < Admin::ApplicationController
...
@@ -9,8 +9,17 @@ class Admin::UsersController < Admin::ApplicationController
end
end
def
show
def
show
end
def
projects
@personal_projects
=
user
.
personal_projects
@personal_projects
=
user
.
personal_projects
@joined_projects
=
user
.
projects
.
joined
(
@user
)
@joined_projects
=
user
.
projects
.
joined
(
@user
)
end
def
groups
end
def
keys
@keys
=
user
.
keys
@keys
=
user
.
keys
end
end
...
...
app/views/admin/identities/index.html.haml
View file @
cc04c5b8
%h3
.page-title
-
page_title
"Identities"
,
@user
.
name
,
"Users"
Identities for
=
render
'admin/users/head'
=
link_to
@user
.
name
,
[
:admin
,
@user
]
%hr
-
if
@identities
.
present?
-
if
@identities
.
present?
%table
.table
%table
.table
%thead
%thead
...
...
app/views/admin/users/_head.html.haml
0 → 100644
View file @
cc04c5b8
%h3
.page-title
=
@user
.
name
-
if
@user
.
blocked?
%span
.cred
(Blocked)
-
if
@user
.
admin
%span
.cred
(Admin)
.pull-right
=
link_to
edit_admin_user_path
(
@user
),
class:
"btn btn-grouped"
do
%i
.fa.fa-pencil-square-o
Edit
%ul
.nav.nav-tabs
=
nav_link
(
path:
'users#show'
)
do
=
link_to
"Account"
,
admin_user_path
(
@user
)
=
nav_link
(
path:
'users#groups'
)
do
=
link_to
"Groups"
,
groups_admin_user_path
(
@user
)
=
nav_link
(
path:
'users#projects'
)
do
=
link_to
"Projects"
,
projects_admin_user_path
(
@user
)
=
nav_link
(
path:
'users#keys'
)
do
=
link_to
"SSH keys"
,
keys_admin_user_path
(
@user
)
=
nav_link
(
controller: :identities
)
do
=
link_to
"Identities"
,
admin_user_identities_path
(
@user
)
app/views/admin/users/groups.html.haml
0 → 100644
View file @
cc04c5b8
-
page_title
"Groups"
,
@user
.
name
,
"Users"
=
render
'admin/users/head'
-
if
@user
.
group_members
.
present?
.panel.panel-default
.panel-heading
Groups:
%ul
.well-list
-
@user
.
group_members
.
each
do
|
group_member
|
-
group
=
group_member
.
group
%li
.group_member
%span
{
class:
(
"list-item-name"
unless
group_member
.
owner?
)}
%strong
=
link_to
group
.
name
,
admin_group_path
(
group
)
.pull-right
%span
.light
=
group_member
.
human_access
-
unless
group_member
.
owner?
=
link_to
group_group_member_path
(
group
,
group_member
),
data:
{
confirm:
remove_user_from_group_message
(
group
,
group_member
)
},
method: :delete
,
remote:
true
,
class:
"btn-xs btn btn-remove"
,
title:
'Remove user from group'
do
%i
.fa.fa-times.fa-inverse
-
else
.nothing-here-block
This user has no groups.
app/views/admin/users/keys.html.haml
0 → 100644
View file @
cc04c5b8
-
page_title
"Keys"
,
@user
.
name
,
"Users"
=
render
'admin/users/head'
=
render
'profiles/keys/key_table'
,
admin:
true
app/views/admin/users/projects.html.haml
0 → 100644
View file @
cc04c5b8
-
page_title
"Projects"
,
@user
.
name
,
"Users"
=
render
'admin/users/head'
-
if
@user
.
groups
.
any?
.panel.panel-default
.panel-heading
Group projects
%ul
.well-list
-
@user
.
groups
.
each
do
|
group
|
%li
%strong
=
group
.
name
–
access to
#{
pluralize
(
group
.
projects
.
count
,
'project'
)
}
.row
.col-md-6
-
if
@personal_projects
.
present?
=
render
'users/projects'
,
projects:
@personal_projects
-
else
.nothing-here-block
This user has no personal projects.
.col-md-6
.panel.panel-default
.panel-heading
Joined projects (
#{
@joined_projects
.
count
}
)
%ul
.well-list
-
@joined_projects
.
sort_by
(
&
:name_with_namespace
).
each
do
|
project
|
-
member
=
project
.
team
.
find_member
(
@user
.
id
)
%li
.project_member
.list-item-name
=
link_to
admin_namespace_project_path
(
project
.
namespace
,
project
),
class:
dom_class
(
project
)
do
=
project
.
name_with_namespace
-
if
member
.pull-right
-
if
member
.
owner?
%span
.light
Owner
-
else
%span
.light
=
member
.
human_access
-
if
member
.
respond_to?
:project
=
link_to
namespace_project_project_member_path
(
project
.
namespace
,
project
,
member
),
data:
{
confirm:
remove_from_project_team_message
(
project
,
member
)
},
remote:
true
,
method: :delete
,
class:
"btn-xs btn btn-remove"
,
title:
'Remove user from project'
do
%i
.fa.fa-times
app/views/admin/users/show.html.haml
View file @
cc04c5b8
-
page_title
@user
.
name
,
"Users"
-
page_title
@user
.
name
,
"Users"
%h3
.page-title
=
render
'admin/users/head'
,
page_name:
'Account'
User:
=
@user
.
name
.row
-
if
@user
.
blocked?
.col-md-6
%span
.cred
(Blocked)
.panel.panel-default
-
if
@user
.
admin
.panel-heading
%span
.cred
(Admin)
=
@user
.
name
%ul
.well-list
.pull-right
%li
=
link_to
edit_admin_user_path
(
@user
),
class:
"btn btn-grouped"
do
=
image_tag
avatar_icon
(
@user
.
email
,
60
),
class:
"avatar s60"
%i
.fa.fa-pencil-square-o
%li
Edit
%span
.light
Profile page:
%hr
%strong
%ul
.nav.nav-tabs
=
link_to
user_path
(
@user
)
do
%li
.active
=
@user
.
username
%a
{
"data-toggle"
=>
"tab"
,
href:
"#account"
}
Account
=
render
'users/profile'
,
user:
@user
%li
%a
{
"data-toggle"
=>
"tab"
,
href:
"#profile"
}
Profile
.panel.panel-default
%li
.panel-heading
%a
{
"data-toggle"
=>
"tab"
,
href:
"#groups"
}
Groups
Account:
%li
%ul
.well-list
%a
{
"data-toggle"
=>
"tab"
,
href:
"#projects"
}
Projects
%li
%li
%span
.light
Name:
%a
{
"data-toggle"
=>
"tab"
,
href:
"#ssh-keys"
}
SSH keys
%strong
=
@user
.
name
%li
%li
=
link_to
"Identities"
,
admin_user_identities_path
(
@user
)
%span
.light
Username:
%strong
.tab-content
=
@user
.
username
#account
.tab-pane.active
%li
.row
%span
.light
Email:
.col-md-6
%strong
.panel.panel-default
=
mail_to
@user
.
email
.panel-heading
-
@user
.
emails
.
each
do
|
email
|
Account:
%li
%ul
.well-list
%span
.light
Secondary email:
%li
%strong
=
email
.
email
%span
.light
Name:
=
link_to
remove_email_admin_user_path
(
@user
,
email
),
data:
{
confirm:
"Are you sure you want to remove
#{
email
.
email
}
?"
},
method: :delete
,
class:
"btn-xs btn btn-remove pull-right"
,
title:
'Remove secondary email'
,
id:
"remove_email_
#{
email
.
id
}
"
do
%strong
=
@user
.
name
%i
.fa.fa-times
%li
%span
.light
Username:
%li
%strong
%span
.light
Can create groups:
=
@user
.
username
%strong
%li
=
@user
.
can_create_group
?
"Yes"
:
"No"
%span
.light
Email:
%li
%strong
%span
.light
Personal projects limit:
=
mail_to
@user
.
email
%strong
-
@user
.
emails
.
each
do
|
email
|
=
@user
.
projects_limit
%li
%li
%span
.light
Secondary email:
%span
.light
Member since:
%strong
=
email
.
email
%strong
=
link_to
remove_email_admin_user_path
(
@user
,
email
),
data:
{
confirm:
"Are you sure you want to remove
#{
email
.
email
}
?"
},
method: :delete
,
class:
"btn-xs btn btn-remove pull-right"
,
title:
'Remove secondary email'
,
id:
"remove_email_
#{
email
.
id
}
"
do
=
@user
.
created_at
.
stamp
(
"Nov 12, 2031"
)
%i
.fa.fa-times
-
if
@user
.
confirmed_at
%li
%li
%span
.light
Confirmed at:
%span
.light
Can create groups:
%strong
%strong
=
@user
.
confirmed_at
.
stamp
(
"Nov 12, 2031"
)
=
@user
.
can_create_group
?
"Yes"
:
"No"
-
else
%li
%li
%span
.light
Personal projects limit:
%span
.light
Confirmed:
%strong
%strong
.cred
=
@user
.
projects_limit
No
%li
%span
.light
Member since:
%li
%strong
%span
.light
Current sign-in at:
=
@user
.
created_at
.
stamp
(
"Nov 12, 2031"
)
%strong
-
if
@user
.
confirmed_at
-
if
@user
.
current_sign_in_at
%li
=
@user
.
current_sign_in_at
.
stamp
(
"Nov 12, 2031"
)
%span
.light
Confirmed at:
%strong
=
@user
.
confirmed_at
.
stamp
(
"Nov 12, 2031"
)
-
else
-
else
%li
never
%span
.light
Confirmed:
%strong
.cred
No
%li
%span
.light
Current sign-in at:
%strong
-
if
@user
.
current_sign_in_at
=
@user
.
current_sign_in_at
.
stamp
(
"Nov 12, 2031"
)
-
else
never
%li
%span
.light
Last sign-in at:
%strong
-
if
@user
.
last_sign_in_at
=
@user
.
last_sign_in_at
.
stamp
(
"Nov 12, 2031"
)
-
else
never
%li
%span
.light
Sign-in count:
%strong
=
@user
.
sign_in_count
-
if
@user
.
ldap_user?
%li
%span
.light
LDAP uid:
%strong
=
@user
.
ldap_identity
.
extern_uid
-
if
@user
.
created_by
%li
%span
.light
Created by:
%strong
=
link_to
@user
.
created_by
.
name
,
[
:admin
,
@user
.
created_by
]
.col-md-6
-
unless
@user
==
current_user
-
if
@user
.
blocked?
.panel.panel-info
.panel-heading
This user is blocked
.panel-body
%p
Blocking user has the following effects:
%ul
%li
User will not be able to login
%li
User will not be able to access git repositories
%li
Personal projects will be left
%li
Owned groups will be left
%br
=
link_to
'Unblock user'
,
unblock_admin_user_path
(
@user
),
method: :put
,
class:
"btn btn-info"
,
data:
{
confirm:
'Are you sure?'
}
-
else
.panel.panel-warning
.panel-heading
Block this user
.panel-body
%p
Blocking user has the following effects:
%ul
%li
User will not be able to login
%li
User will not be able to access git repositories
%li
User will be removed from joined projects and groups
%li
Personal projects will be left
%li
Owned groups will be left
%br
=
link_to
'Block user'
,
block_admin_user_path
(
@user
),
data:
{
confirm:
'USER WILL BE BLOCKED! Are you sure?'
},
method: :put
,
class:
"btn btn-warning"
.panel.panel-danger
%li
.panel-heading
%span
.light
Last sign-in at:
Remove user
%strong
.panel-body
-
if
@user
.
last_sign_in_at
-
if
@user
.
can_be_removed?
=
@user
.
last_sign_in_at
.
stamp
(
"Nov 12, 2031"
)
%p
Deleting a user has the following effects:
-
else
%ul
never
%li
All user content like authored issues, snippets, comments will be removed
-
rp
=
@user
.
personal_projects
.
count
%li
-
unless
rp
.
zero?
%span
.light
Sign-in count:
%li
#{
pluralize
rp
,
'personal project'
}
will be removed and cannot be restored
%strong
%br
=
@user
.
sign_in_count
=
link_to
'Remove user'
,
[
:admin
,
@user
],
data:
{
confirm:
"USER
#{
@user
.
name
}
WILL BE REMOVED! Are you sure?"
},
method: :delete
,
class:
"btn btn-remove"
-
else
-
if
@user
.
ldap_user?
-
if
@user
.
solo_owned_groups
.
present?
%li
%p
%span
.light
LDAP uid:
This user is currently an owner in these groups:
%strong
%strong
#{
@user
.
solo_owned_groups
.
map
(
&
:name
).
join
(
', '
)
}
=
@user
.
ldap_identity
.
extern_uid
%p
You must transfer ownership or delete these groups before you can delete this user.
-
if
@user
.
created_by
%li
#profile
.tab-pane
%span
.light
Created by:
.row
%strong
.col-md-6
=
link_to
@user
.
created_by
.
name
,
[
:admin
,
@user
.
created_by
]
.panel.panel-default
.col-md-6
-
unless
@user
==
current_user
-
if
@user
.
blocked?
.panel.panel-info
.panel-heading
.panel-heading
=
@user
.
name
This user is blocked
%ul
.well-list
.panel-body
%li
%p
Blocking user has the following effects:
=
image_tag
avatar_icon
(
@user
.
email
,
60
),
class:
"avatar s60"
%ul
%li
%li
User will not be able to login
%span
.light
Profile page:
%li
User will not be able to access git repositories
%strong
%li
Personal projects will be left
=
link_to
user_path
(
@user
)
do
%li
Owned groups will be left
=
@user
.
username
%br
.col-md-6
=
link_to
'Unblock user'
,
unblock_admin_user_path
(
@user
),
method: :put
,
class:
"btn btn-info"
,
data:
{
confirm:
'Are you sure?'
}
=
render
'users/profile'
,
user:
@user
-
else
.panel.panel-warning
#groups
.tab-pane
.panel-heading
-
if
@user
.
group_members
.
present?
Block this user
.panel.panel-default
.panel-body
.panel-heading
Groups:
%p
Blocking user has the following effects:
%ul
.well-list
%ul
-
@user
.
group_members
.
each
do
|
group_member
|
%li
User will not be able to login
-
group
=
group_member
.
group
%li
User will not be able to access git repositories
%li
.group_member
%li
User will be removed from joined projects and groups
%span
{
class:
(
"list-item-name"
unless
group_member
.
owner?
)}
%li
Personal projects will be left
%strong
=
link_to
group
.
name
,
admin_group_path
(
group
)
%li
Owned groups will be left
.pull-right
%br
%span
.light
=
group_member
.
human_access
=
link_to
'Block user'
,
block_admin_user_path
(
@user
),
data:
{
confirm:
'USER WILL BE BLOCKED! Are you sure?'
},
method: :put
,
class:
"btn btn-warning"
-
unless
group_member
.
owner?
=
link_to
group_group_member_path
(
group
,
group_member
),
data:
{
confirm:
remove_user_from_group_message
(
group
,
group_member
)
},
method: :delete
,
remote:
true
,
class:
"btn-xs btn btn-remove"
,
title:
'Remove user from group'
do
.panel.panel-danger
%i
.fa.fa-times.fa-inverse
.panel-heading
-
else
Remove user
.nothing-here-block
This user has no groups.
.panel-body
-
if
@user
.
can_be_removed?
#projects
.tab-pane
%p
Deleting a user has the following effects:
-
if
@user
.
groups
.
any?
%ul
.panel.panel-default
%li
All user content like authored issues, snippets, comments will be removed
.panel-heading
Group projects
-
rp
=
@user
.
personal_projects
.
count
%ul
.well-list
-
unless
rp
.
zero?
-
@user
.
groups
.
each
do
|
group
|
%li
#{
pluralize
rp
,
'personal project'
}
will be removed and cannot be restored
%li
%br
%strong
=
group
.
name
=
link_to
'Remove user'
,
[
:admin
,
@user
],
data:
{
confirm:
"USER
#{
@user
.
name
}
WILL BE REMOVED! Are you sure?"
},
method: :delete
,
class:
"btn btn-remove"
–
access to
-
else
#{
pluralize
(
group
.
projects
.
count
,
'project'
)
}
-
if
@user
.
solo_owned_groups
.
present?
%p
.row
This user is currently an owner in these groups:
.col-md-6
%strong
#{
@user
.
solo_owned_groups
.
map
(
&
:name
).
join
(
', '
)
}
=
render
'users/projects'
,
projects:
@personal_projects
%p
You must transfer ownership or delete these groups before you can delete this user.
.col-md-6
.panel.panel-default
.panel-heading
Joined projects (
#{
@joined_projects
.
count
}
)
%ul
.well-list
-
@joined_projects
.
sort_by
(
&
:name_with_namespace
).
each
do
|
project
|
-
member
=
project
.
team
.
find_member
(
@user
.
id
)
%li
.project_member
.list-item-name
=
link_to
admin_namespace_project_path
(
project
.
namespace
,
project
),
class:
dom_class
(
project
)
do
=
project
.
name_with_namespace
-
if
member
.pull-right
-
if
member
.
owner?
%span
.light
Owner
-
else
%span
.light
=
member
.
human_access
-
if
member
.
respond_to?
:project
=
link_to
namespace_project_project_member_path
(
project
.
namespace
,
project
,
member
),
data:
{
confirm:
remove_from_project_team_message
(
project
,
member
)
},
remote:
true
,
method: :delete
,
class:
"btn-xs btn btn-remove"
,
title:
'Remove user from project'
do
%i
.fa.fa-times
#ssh-keys
.tab-pane
=
render
'profiles/keys/key_table'
,
admin:
true
config/routes.rb
View file @
cc04c5b8
...
@@ -152,6 +152,9 @@ Gitlab::Application.routes.draw do
...
@@ -152,6 +152,9 @@ Gitlab::Application.routes.draw do
resources
:identities
,
only:
[
:index
,
:edit
,
:update
,
:destroy
]
resources
:identities
,
only:
[
:index
,
:edit
,
:update
,
:destroy
]
member
do
member
do
get
:projects
get
:keys
get
:groups
put
:team_update
put
:team_update
put
:block
put
:block
put
:unblock
put
:unblock
...
...
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