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
a5dbe353
Commit
a5dbe353
authored
Jun 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve change group ownership logic
parent
db03bfa8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
groups_controller.rb
app/controllers/admin/groups_controller.rb
+1
-1
group.rb
app/models/group.rb
+11
-0
No files found.
app/controllers/admin/groups_controller.rb
View file @
a5dbe353
...
@@ -34,7 +34,7 @@ class Admin::GroupsController < Admin::ApplicationController
...
@@ -34,7 +34,7 @@ class Admin::GroupsController < Admin::ApplicationController
owner_id
=
group_params
.
delete
(
:owner_id
)
owner_id
=
group_params
.
delete
(
:owner_id
)
if
owner_id
if
owner_id
@group
.
owner
=
User
.
find
(
owner_id
)
@group
.
change_owner
(
User
.
find
(
owner_id
)
)
end
end
if
@group
.
update_attributes
(
group_params
)
if
@group
.
update_attributes
(
group_params
)
...
...
app/models/group.rb
View file @
a5dbe353
...
@@ -32,6 +32,17 @@ class Group < Namespace
...
@@ -32,6 +32,17 @@ class Group < Namespace
end
end
end
end
def
change_owner
(
user
)
self
.
owner
=
user
membership
=
users_groups
.
where
(
user_id:
user
.
id
).
first
if
membership
membership
.
update_attributes
(
group_access:
UsersGroup
::
OWNER
)
else
add_owner
end
end
private
private
def
add_owner
def
add_owner
...
...
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