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
Léo-Paul Géneau
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+1
-1
app/models/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
owner_id
=
group_params
.
delete
(
:owner_id
)
if
owner_id
@group
.
owner
=
User
.
find
(
owner_id
)
@group
.
change_owner
(
User
.
find
(
owner_id
)
)
end
if
@group
.
update_attributes
(
group_params
)
...
...
app/models/group.rb
View file @
a5dbe353
...
...
@@ -32,6 +32,17 @@ class Group < Namespace
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
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