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
32ef2f37
Commit
32ef2f37
authored
Jun 18, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add owner to group members after group create
parent
ed9cff9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
18 deletions
+14
-18
groups_controller.rb
app/controllers/groups_controller.rb
+1
-1
group.rb
app/models/group.rb
+13
-17
No files found.
app/controllers/groups_controller.rb
View file @
32ef2f37
...
...
@@ -72,7 +72,7 @@ class GroupsController < ApplicationController
def
update
group_params
=
params
[
:group
].
dup
owner_id
=
group_params
.
delete
(
:owner_id
)
owner_id
=
group_params
.
delete
(
:owner_id
)
if
owner_id
@group
.
owner
=
User
.
find
(
owner_id
)
...
...
app/models/group.rb
View file @
32ef2f37
...
...
@@ -16,29 +16,25 @@ class Group < Namespace
has_many
:users_groups
,
dependent: :destroy
has_many
:users
,
through: :users_groups
def
add_users
(
user_ids
,
group_access
)
user_ids
.
compact
.
each
do
|
user_id
|
self
.
users_groups
.
create
(
user_id:
user_id
,
group_access:
group_access
)
end
end
def
add_users_to_project_teams
(
user_ids
,
project_access
)
UsersProject
.
add_users_into_projects
(
projects
.
map
(
&
:id
),
user_ids
,
project_access
)
end
after_create
:add_owner
def
human_name
name
end
def
truncate_teams
UsersProject
.
truncate_teams
(
project_ids
)
end
def
owners
@owners
||=
(
users_groups
.
owners
.
map
(
&
:user
)
<<
owner
)
end
def
add_users
(
user_ids
,
group_access
)
user_ids
.
compact
.
each
do
|
user_id
|
self
.
users_groups
.
create
(
user_id:
user_id
,
group_access:
group_access
)
end
end
private
def
add_owner
self
.
add_users
([
owner
.
id
],
UsersGroup
::
OWNER
)
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