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
944b2450
Commit
944b2450
authored
Jan 28, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2801 from Takuto88/master
Fix #2790
parents
df6db81e
f9a48f72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
lib/tasks/gitlab/bulk_add_permission.rake
lib/tasks/gitlab/bulk_add_permission.rake
+8
-8
No files found.
lib/tasks/gitlab/bulk_add_permission.rake
View file @
944b2450
...
@@ -4,21 +4,21 @@ namespace :gitlab do
...
@@ -4,21 +4,21 @@ namespace :gitlab do
task
:all_users_to_all_projects
=>
:environment
do
|
t
,
args
|
task
:all_users_to_all_projects
=>
:environment
do
|
t
,
args
|
user_ids
=
User
.
where
(
:admin
=>
false
).
pluck
(
:id
)
user_ids
=
User
.
where
(
:admin
=>
false
).
pluck
(
:id
)
admin_ids
=
User
.
where
(
:admin
=>
true
).
pluck
(
:id
)
admin_ids
=
User
.
where
(
:admin
=>
true
).
pluck
(
:id
)
projects_ids
=
Project
.
pluck
(
:id
)
Project
.
find_each
do
|
project
|
puts
"Importing
#{
user_ids
.
size
}
users into
#{
projects_ids
.
size
}
projects"
puts
"Importing
#{
user_ids
.
size
}
users into
#{
project
.
code
}
"
UsersProject
.
add_users_into_projects
(
projects_ids
,
user_ids
,
UsersProject
::
DEVELOPER
)
UsersProject
.
bulk_import
(
project
,
user_ids
,
UsersProject
::
DEVELOPER
)
puts
"Importing
#{
admin_ids
.
size
}
admins into
#{
project
.
code
}
"
puts
"Importing
#{
admin_ids
.
size
}
admins into
#{
projects_ids
.
size
}
projects"
UsersProject
.
bulk_import
(
project
,
admin_ids
,
UsersProject
::
MASTER
)
UsersProject
.
add_users_into_projects
(
projects_ids
,
admin_ids
,
UsersProject
::
MASTER
)
end
end
end
desc
"GITLAB | Add a specific user to all projects (as a developer)"
desc
"GITLAB | Add a specific user to all projects (as a developer)"
task
:user_to_projects
,
[
:email
]
=>
:environment
do
|
t
,
args
|
task
:user_to_projects
,
[
:email
]
=>
:environment
do
|
t
,
args
|
user
=
User
.
find_by_email
args
.
email
user
=
User
.
find_by_email
args
.
email
project_ids
=
Project
.
pluck
(
:id
)
project_ids
=
Project
.
pluck
(
:id
)
puts
"Importing
#{
user
.
email
}
users into
#{
project_ids
.
size
}
projects"
UsersProject
.
user_bulk_import
(
user
,
project_ids
,
UsersProject
::
DEVELOPER
)
UsersProject
.
add_users_into_projects
(
project_ids
,
Array
.
wrap
(
user
.
id
)
,
UsersProject
::
DEVELOPER
)
end
end
end
end
end
end
\ No newline at end of file
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