BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
643a6e58
Commit
643a6e58
authored
Aug 27, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve admin user show page
Show permissions for all project. Add ability to remove user from group if not an owner Remove unnecessary admin controller
parent
24e26d8b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
20 deletions
+30
-20
admin.js.coffee
app/assets/javascripts/admin.js.coffee
+7
-1
members_controller.rb
app/controllers/admin/members_controller.rb
+0
-9
project_team.rb
app/models/project_team.rb
+9
-1
show.html.haml
app/views/admin/users/show.html.haml
+9
-4
routes.rb
config/routes.rb
+1
-5
access.rb
lib/gitlab/access.rb
+4
-0
No files found.
app/assets/javascripts/admin.js.coffee
View file @
643a6e58
...
...
@@ -23,10 +23,16 @@ class Admin
e
.
preventDefault
()
$
(
this
).
hide
()
modal
.
show
()
$
(
'.change-owner-cancel-link'
).
bind
"click"
,
(
e
)
->
e
.
preventDefault
()
modal
.
hide
()
$
(
'.change-owner-link'
).
show
()
$
(
'li.users_project'
).
bind
'ajax:success'
,
->
Turbolinks
.
visit
(
location
.
href
)
$
(
'li.users_group'
).
bind
'ajax:success'
,
->
Turbolinks
.
visit
(
location
.
href
)
@
Admin
=
Admin
app/controllers/admin/members_controller.rb
deleted
100644 → 0
View file @
24e26d8b
class
Admin
::
MembersController
<
Admin
::
ApplicationController
def
destroy
user
=
User
.
find_by_username
(
params
[
:id
])
project
=
Project
.
find_with_namespace
(
params
[
:project_id
])
project
.
users_projects
.
where
(
user_id:
user
).
first
.
destroy
redirect_to
:back
end
end
app/models/project_team.rb
View file @
643a6e58
...
...
@@ -32,7 +32,15 @@ class ProjectTeam
end
def
find_tm
(
user_id
)
project
.
users_projects
.
find_by_user_id
(
user_id
)
tm
=
project
.
users_projects
.
find_by_user_id
(
user_id
)
# If user is not in project members
# we should check for group membership
if
group
&&
!
tm
tm
=
group
.
users_groups
.
find_by_user_id
(
user_id
)
end
tm
end
def
add_user
(
user
,
access
)
...
...
app/views/admin/users/show.html.haml
View file @
643a6e58
...
...
@@ -95,17 +95,20 @@
%ul
.well-list
-
@user
.
users_groups
.
each
do
|
user_group
|
-
group
=
user_group
.
group
%li
%li
.users_group
%strong
=
link_to
group
.
name
,
admin_group_path
(
group
)
.pull-right
%span
.light
=
user_group
.
human_access
-
unless
user_group
.
owner?
=
link_to
group_users_group_path
(
group
,
user_group
),
confirm:
remove_user_from_group_message
(
group
,
@user
),
method: :delete
,
remote:
true
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from group'
do
%i
.icon-remove.icon-white
.ui-box
.title
Projects (
#{
@projects
.
count
}
)
%ul
.well-list
-
@projects
.
sort_by
(
&
:name_with_namespace
).
each
do
|
project
|
-
tm
=
project
.
team
.
find_tm
(
@user
.
id
)
%li
%li
.users_project
=
link_to
admin_project_path
(
project
),
class:
dom_class
(
project
)
do
-
if
project
.
namespace
=
project
.
namespace
.
human_name
...
...
@@ -119,7 +122,9 @@
%span
.light
Owner
-
else
%span
.light
=
tm
.
human_access
=
link_to
admin_project_member_path
(
project
,
tm
.
user
),
confirm:
remove_from_project_team_message
(
project
,
@user
),
method: :delete
,
class:
"btn btn-small btn-remove"
do
%i
.icon-remove
-
if
tm
.
respond_to?
:project
=
link_to
project_team_member_path
(
project
,
@user
),
confirm:
remove_from_project_team_message
(
project
,
@user
),
remote:
true
,
method: :delete
,
class:
"btn-tiny btn btn-remove"
,
title:
'Remove user from project'
do
%i
.icon-remove
config/routes.rb
View file @
643a6e58
...
...
@@ -89,11 +89,7 @@ Gitlab::Application.routes.draw do
resource
:logs
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
resources
:projects
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
},
only:
[
:index
,
:show
]
do
resources
:members
,
only:
[
:destroy
]
end
resources
:projects
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
},
only:
[
:index
,
:show
]
root
to:
"dashboard#index"
end
...
...
lib/gitlab/access.rb
View file @
643a6e58
...
...
@@ -44,5 +44,9 @@ module Gitlab
def
human_access
Gitlab
::
Access
.
options_with_owner
.
key
(
access_field
)
end
def
owner?
access_field
==
OWNER
end
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