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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
98044f0f
Commit
98044f0f
authored
Dec 26, 2012
by
Andrey Kumanyaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code duplication removed from controllers
parent
39e7a0ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+1
-3
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+1
-3
app/models/group.rb
app/models/group.rb
+6
-0
No files found.
app/controllers/admin/groups_controller.rb
View file @
98044f0f
...
...
@@ -68,9 +68,7 @@ class Admin::GroupsController < AdminController
end
def
project_teams_update
@group
.
projects
.
each
do
|
project
|
project
.
add_users_ids_to_team
(
params
[
:user_ids
],
params
[
:project_access
])
end
@group
.
add_users_to_project_teams
(
params
[
:user_ids
],
params
[
:project_access
])
redirect_to
[
:admin
,
@group
],
notice:
'Users was successfully added.'
end
...
...
app/controllers/groups_controller.rb
View file @
98044f0f
...
...
@@ -59,9 +59,7 @@ class GroupsController < ApplicationController
end
def
team_members
@group
.
projects
.
each
do
|
project
|
project
.
add_users_ids_to_team
(
params
[
:user_ids
],
params
[
:project_access
])
end
@group
.
add_users_to_project_teams
(
params
[
:user_ids
],
params
[
:project_access
])
redirect_to
people_group_path
(
@group
),
notice:
'Users was successfully added.'
end
...
...
app/models/group.rb
View file @
98044f0f
...
...
@@ -12,6 +12,12 @@
#
class
Group
<
Namespace
def
add_users_to_project_teams
(
user_ids
,
project_access
)
projects
.
each
do
|
project
|
project
.
add_users_ids_to_team
(
user_ids
,
project_access
)
end
end
def
users
users
=
User
.
joins
(
:users_projects
).
where
(
users_projects:
{
project_id:
project_ids
})
users
=
users
<<
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