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
d20db103
Commit
d20db103
authored
Oct 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'readding_group_member' of /home/git/repositories/gitlab/gitlabhq
parents
eda5b3b1
97cf31c4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
app/models/group.rb
app/models/group.rb
+2
-1
spec/models/group_spec.rb
spec/models/group_spec.rb
+12
-0
No files found.
app/models/group.rb
View file @
d20db103
...
...
@@ -26,7 +26,8 @@ class Group < Namespace
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
)
user
=
self
.
users_groups
.
find_or_initialize_by_user_id
(
user_id
)
user
.
update_attributes
(
group_access:
group_access
)
end
end
...
...
spec/models/group_spec.rb
View file @
d20db103
...
...
@@ -42,4 +42,16 @@ describe Group do
it
{
group
.
users_groups
.
masters
.
map
(
&
:user
).
should
include
(
user
)
}
end
describe
:add_users
do
let
(
:user
)
{
create
(
:user
)
}
before
{
group
.
add_users
([
user
.
id
],
UsersGroup
::
GUEST
)
}
it
"should update the group permission"
do
group
.
users_groups
.
guests
.
map
(
&
:user
).
should
include
(
user
)
group
.
add_users
([
user
.
id
],
UsersGroup
::
DEVELOPER
)
group
.
users_groups
.
developers
.
map
(
&
:user
).
should
include
(
user
)
group
.
users_groups
.
guests
.
map
(
&
:user
).
should_not
include
(
user
)
end
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