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
1acff973
Commit
1acff973
authored
Dec 20, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename add_user_to_project_teams to gitlab:import:user_to_projects
Rename add_users_to_project_teams to gitlab:import:all_users_to_all_projects
parent
c9bf2bb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
19 deletions
+24
-19
user_management.md
doc/raketasks/user_management.md
+2
-2
bulk_add_permission.rake
lib/tasks/gitlab/bulk_add_permission.rake
+22
-17
No files found.
doc/raketasks/user_management.md
View file @
1acff973
### Add user to as a developer to all projects
```
bundle exec rake
add_user_to_project_team
s[username@domain.tld]
bundle exec rake
gitlab:import:user_to_project
s[username@domain.tld]
```
...
...
@@ -12,5 +12,5 @@ Notes:
*
admin users are added as masters
```
bundle exec rake
add_users_to_project_team
s
bundle exec rake
gitlab:import:all_users_to_all_project
s
```
lib/tasks/bulk_add_permission.rake
→
lib/tasks/
gitlab/
bulk_add_permission.rake
View file @
1acff973
desc
"Add all users to all projects (admin users are added as masters)"
task
:add_users_to_project_teams
=>
:environment
do
|
t
,
args
|
user_ids
=
User
.
where
(
:admin
=>
false
).
pluck
(
:id
)
admin_ids
=
User
.
where
(
:admin
=>
true
).
pluck
(
:id
)
namespace
:gitlab
do
namespace
:import
do
desc
"GITLAB | Add all users to all projects (admin users are added as masters)"
task
:all_users_to_all_projects
=>
:environment
do
|
t
,
args
|
user_ids
=
User
.
where
(
:admin
=>
false
).
pluck
(
:id
)
admin_ids
=
User
.
where
(
:admin
=>
true
).
pluck
(
:id
)
Project
.
find_each
do
|
project
|
puts
"Importing
#{
user_ids
.
size
}
users into
#{
project
.
code
}
"
UsersProject
.
bulk_import
(
project
,
user_ids
,
UsersProject
::
DEVELOPER
)
puts
"Importing
#{
admin_ids
.
size
}
admins into
#{
project
.
code
}
"
UsersProject
.
bulk_import
(
project
,
admin_ids
,
UsersProject
::
MASTER
)
end
end
Project
.
find_each
do
|
project
|
puts
"Importing
#{
user_ids
.
size
}
users into
#{
project
.
code
}
"
UsersProject
.
bulk_import
(
project
,
user_ids
,
UsersProject
::
DEVELOPER
)
puts
"Importing
#{
admin_ids
.
size
}
admins into
#{
project
.
code
}
"
UsersProject
.
bulk_import
(
project
,
admin_ids
,
UsersProject
::
MASTER
)
end
end
desc
"Add user to as a developer to all projects
"
task
:add_user_to_project_team
s
,
[
:email
]
=>
:environment
do
|
t
,
args
|
user
=
User
.
find_by_email
args
.
email
project_ids
=
Project
.
pluck
(
:id
)
desc
"GITLAB | Add a specific user to all projects (as a developer)
"
task
:user_to_project
s
,
[
:email
]
=>
:environment
do
|
t
,
args
|
user
=
User
.
find_by_email
args
.
email
project_ids
=
Project
.
pluck
(
:id
)
UsersProject
.
user_bulk_import
(
user
,
project_ids
,
UsersProject
::
DEVELOPER
)
end
UsersProject
.
user_bulk_import
(
user
,
project_ids
,
UsersProject
::
DEVELOPER
)
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