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
Tatuya Kamada
gitlab-ce
Commits
2dc05192
Commit
2dc05192
authored
Sep 06, 2012
by
miks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bulk access roles update/deletion added
parent
3d3c6674
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
app/models/users_project.rb
app/models/users_project.rb
+17
-0
app/roles/team.rb
app/roles/team.rb
+13
-0
No files found.
app/models/users_project.rb
View file @
2dc05192
...
...
@@ -20,6 +20,23 @@ class UsersProject < ActiveRecord::Base
delegate
:name
,
:email
,
to: :user
,
prefix:
true
def
self
.
bulk_delete
(
project
,
user_ids
)
UsersProject
.
transaction
do
UsersProject
.
where
(
:user_id
=>
user_ids
,
:project_id
=>
project
.
id
).
each
do
|
users_project
|
users_project
.
delete
end
end
end
def
self
.
bulk_update
(
project
,
user_ids
,
project_access
)
UsersProject
.
transaction
do
UsersProject
.
where
(
:user_id
=>
user_ids
,
:project_id
=>
project
.
id
).
each
do
|
users_project
|
users_project
.
project_access
=
project_access
users_project
.
save
end
end
end
def
self
.
bulk_import
(
project
,
user_ids
,
project_access
)
UsersProject
.
transaction
do
user_ids
.
each
do
|
user_id
|
...
...
app/roles/team.rb
View file @
2dc05192
...
...
@@ -36,4 +36,17 @@ module Team
UsersProject
.
bulk_import
(
self
,
users_ids
,
access_role
)
self
.
update_repository
end
# Update multiple project users
# to same access role by user ids
def
update_users_ids_to_role
(
users_ids
,
access_role
)
UsersProject
.
bulk_update
(
self
,
users_ids
,
access_role
)
self
.
update_repository
end
# Delete multiple users from project by user ids
def
delete_users_by_ids
(
users_ids
)
UsersProject
.
bulk_delete
(
self
,
users_ids
)
self
.
update_repository
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