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
iv
gitlab-ce
Commits
e6002bda
Commit
e6002bda
authored
Feb 01, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ability to manage and remove group as owner outside of admin area
parent
591e094e
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
117 additions
and
8 deletions
+117
-8
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+35
-1
app/views/groups/edit.html.haml
app/views/groups/edit.html.haml
+50
-0
app/views/layouts/group.html.haml
app/views/layouts/group.html.haml
+6
-0
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+1
-1
app/views/teams/edit.html.haml
app/views/teams/edit.html.haml
+3
-5
config/routes.rb
config/routes.rb
+1
-1
features/group/group.feature
features/group/group.feature
+6
-0
features/steps/group/group.rb
features/steps/group/group.rb
+11
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+4
-0
No files found.
app/controllers/groups_controller.rb
View file @
e6002bda
...
@@ -6,6 +6,7 @@ class GroupsController < ApplicationController
...
@@ -6,6 +6,7 @@ class GroupsController < ApplicationController
# Authorize
# Authorize
before_filter
:authorize_read_group!
,
except:
[
:new
,
:create
]
before_filter
:authorize_read_group!
,
except:
[
:new
,
:create
]
before_filter
:authorize_admin_group!
,
only:
[
:edit
,
:update
,
:destroy
]
before_filter
:authorize_create_group!
,
only:
[
:new
,
:create
]
before_filter
:authorize_create_group!
,
only:
[
:new
,
:create
]
# Load group projects
# Load group projects
...
@@ -84,6 +85,31 @@ class GroupsController < ApplicationController
...
@@ -84,6 +85,31 @@ class GroupsController < ApplicationController
redirect_to
people_group_path
(
@group
),
notice:
'Users was successfully added.'
redirect_to
people_group_path
(
@group
),
notice:
'Users was successfully added.'
end
end
def
edit
end
def
update
group_params
=
params
[
:group
].
dup
owner_id
=
group_params
.
delete
(
:owner_id
)
if
owner_id
@group
.
owner
=
User
.
find
(
owner_id
)
end
if
@group
.
update_attributes
(
group_params
)
redirect_to
@group
,
notice:
'Group was successfully updated.'
else
render
action:
"edit"
end
end
def
destroy
@group
.
truncate_teams
@group
.
destroy
redirect_to
root_path
,
notice:
'Group was removed.'
end
protected
protected
def
group
def
group
...
@@ -106,6 +132,14 @@ class GroupsController < ApplicationController
...
@@ -106,6 +132,14 @@ class GroupsController < ApplicationController
end
end
def
authorize_create_group!
def
authorize_create_group!
can?
(
current_user
,
:create_group
,
nil
)
unless
can?
(
current_user
,
:create_group
,
nil
)
return
render_404
end
end
def
authorize_admin_group!
unless
can?
(
current_user
,
:manage_group
,
group
)
return
render_404
end
end
end
end
end
app/views/groups/edit.html.haml
0 → 100644
View file @
e6002bda
%h3
.page_title
Edit Group
%hr
=
form_for
@group
do
|
f
|
-
if
@group
.
errors
.
any?
.alert.alert-error
%span
=
@group
.
errors
.
full_messages
.
first
.clearfix
=
f
.
label
:name
do
Group name is
.input
=
f
.
text_field
:name
,
placeholder:
"Ex. OpenSource"
,
class:
"xxlarge left"
=
f
.
submit
'Save group'
,
class:
"btn btn-save"
%hr
.row
.span7
.ui-box
%h5
.title
Projects
%ul
.well-list
-
@group
.
projects
.
each
do
|
project
|
%li
-
if
project
.
public
%i
.icon-share
-
else
%i
.icon-lock.cgreen
=
link_to
project
.
name_with_namespace
,
project
.pull-right
=
link_to
'Team'
,
project_team_index_path
(
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn btn-small"
=
link_to
'Edit'
,
edit_project_path
(
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn btn-small"
=
link_to
'Remove'
,
project
,
confirm:
"REMOVE
#{
project
.
name
}
? Are you sure?"
,
method: :delete
,
class:
"btn btn-small btn-remove"
.span5
.ui-box
%h5
.title
Transfer group
.padded
%p
Transferring group will cause loss of admin control over group and all child projects
=
form_for
@group
do
|
f
|
=
f
.
select
:owner_id
,
User
.
all
.
map
{
|
user
|
[
user
.
name
,
user
.
id
]
},
{},
{
class:
'chosen'
}
=
f
.
submit
'Transfer group'
,
class:
"btn btn-small"
.ui-box
%h5
.title
Remove group
.padded.bgred
%p
Remove of group will cause removing all child projects and resources
%br
Removed group can not be restored!
=
link_to
'Remove Group'
,
@group
,
confirm:
'Removed group can not be restored! Are you sure?'
,
method: :delete
,
class:
"btn btn-remove btn-small"
app/views/layouts/group.html.haml
View file @
e6002bda
...
@@ -22,4 +22,10 @@
...
@@ -22,4 +22,10 @@
=
nav_link
(
path:
'groups#people'
)
do
=
nav_link
(
path:
'groups#people'
)
do
=
link_to
"People"
,
people_group_path
(
@group
)
=
link_to
"People"
,
people_group_path
(
@group
)
-
if
can?
(
current_user
,
:manage_group
,
@group
)
=
nav_link
(
path:
'groups#edit'
)
do
=
link_to
edit_group_path
(
@group
),
class:
"tab "
do
%i
.icon-edit
Edit Group
.content
=
yield
.content
=
yield
app/views/projects/_form.html.haml
View file @
e6002bda
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
=
f
.
check_box
:wiki_enabled
=
f
.
check_box
:wiki_enabled
%span
.descr
Pages for project documentation
%span
.descr
Pages for project documentation
-
if
can?
current_user
,
:change_public_mode
,
@project
-
if
can?
(
current_user
,
:change_public_mode
,
@project
)
%fieldset
.features
%fieldset
.features
%legend
%legend
%i
.icon-share
%i
.icon-share
...
...
app/views/teams/edit.html.haml
View file @
e6002bda
...
@@ -15,8 +15,6 @@
...
@@ -15,8 +15,6 @@
Team path is
Team path is
.input
.input
=
f
.
text_field
:path
,
placeholder:
"opensource"
,
class:
"xxlarge left"
=
f
.
text_field
:path
,
placeholder:
"opensource"
,
class:
"xxlarge left"
.clearfix
.form-actions
.input.span3.center
=
f
.
submit
'Save team changes'
,
class:
"btn btn-primary"
=
f
.
submit
'Save team changes'
,
class:
"btn btn-primary"
.input.span3.center
=
link_to
'Delete team'
,
team_path
(
@team
),
method: :delete
,
confirm:
"You are shure?"
,
class:
"btn btn-remove pull-right"
=
link_to
'Delete team'
,
team_path
(
@team
),
method: :delete
,
confirm:
"You are shure?"
,
class:
"btn btn-remove"
config/routes.rb
View file @
e6002bda
...
@@ -129,7 +129,7 @@ Gitlab::Application.routes.draw do
...
@@ -129,7 +129,7 @@ Gitlab::Application.routes.draw do
#
#
# Groups Area
# Groups Area
#
#
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
,
only:
[
:show
,
:new
,
:create
]
do
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
do
member
do
member
do
get
:issues
get
:issues
get
:merge_requests
get
:merge_requests
...
...
features/group/group.feature
View file @
e6002bda
...
@@ -24,3 +24,9 @@ Feature: Groups
...
@@ -24,3 +24,9 @@ Feature: Groups
When
I visit group people page
When
I visit group people page
And
I select user
"John"
from list with role
"Reporter"
And
I select user
"John"
from list with role
"Reporter"
Then
I should see user
"John"
in team list
Then
I should see user
"John"
in team list
Scenario
:
I
should see edit group page
When
I visit group settings page
And
I change group name
Then
I should see new group name
features/steps/group/group.rb
View file @
e6002bda
...
@@ -82,6 +82,17 @@ class Groups < Spinach::FeatureSteps
...
@@ -82,6 +82,17 @@ class Groups < Spinach::FeatureSteps
current_path
.
should
==
group_path
(
Group
.
last
)
current_path
.
should
==
group_path
(
Group
.
last
)
end
end
And
'I change group name'
do
fill_in
'group_name'
,
:with
=>
'new-name'
click_button
"Save group"
end
Then
'I should see new group name'
do
within
".navbar-gitlab"
do
page
.
should
have_content
"group: new-name"
end
end
protected
protected
def
current_group
def
current_group
...
...
features/steps/shared/paths.rb
View file @
e6002bda
...
@@ -25,6 +25,10 @@ module SharedPaths
...
@@ -25,6 +25,10 @@ module SharedPaths
visit
people_group_path
(
current_group
)
visit
people_group_path
(
current_group
)
end
end
When
'I visit group settings page'
do
visit
edit_group_path
(
current_group
)
end
# ----------------------------------------
# ----------------------------------------
# Dashboard
# Dashboard
# ----------------------------------------
# ----------------------------------------
...
...
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