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
3bd3c93b
Commit
3bd3c93b
authored
Jul 06, 2016
by
Drew Blessing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for stale group owner data
parent
e41d5ef4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
app/models/group.rb
app/models/group.rb
+0
-4
spec/lib/gitlab/ldap/group_sync_spec.rb
spec/lib/gitlab/ldap/group_sync_spec.rb
+8
-9
No files found.
app/models/group.rb
View file @
3bd3c93b
...
...
@@ -104,10 +104,6 @@ class Group < Namespace
end
end
def
owners
@owners
||=
group_members
.
owners
.
includes
(
:user
).
map
(
&
:user
)
end
def
add_users
(
user_ids
,
access_level
,
current_user
=
nil
,
skip_notification:
false
)
user_ids
.
each
do
|
user_id
|
Member
.
add_user
(
self
.
group_members
,
user_id
,
access_level
,
current_user
,
skip_notification:
skip_notification
)
...
...
spec/lib/gitlab/ldap/group_sync_spec.rb
View file @
3bd3c93b
...
...
@@ -160,18 +160,17 @@ describe Gitlab::LDAP::GroupSync, lib: true do
group_access:
Gitlab
::
Access
::
DEVELOPER
,
provider:
'ldapmain'
)
group1
.
add_users
([
user1
.
id
],
group1
.
add_users
([
user1
.
id
,
user2
.
id
],
Gitlab
::
Access
::
OWNER
,
skip_notification:
true
)
end
it
'refuses to downgrade the last owner'
do
expect
{
group_sync
.
sync_groups
}
.
not_to
change
{
group1
.
members
.
where
(
user_id:
user1
.
id
,
access_level:
Gitlab
::
Access
::
OWNER
).
any?
}
# Check two users in a loop to uncover any stale group owner data
it
'downgrades one user but not the other'
do
group_sync
.
sync_groups
expect
(
group1
.
members
.
pluck
(
:access_level
).
sort
)
.
to
eq
([
Gitlab
::
Access
::
DEVELOPER
,
Gitlab
::
Access
::
OWNER
])
end
context
'when user is a member of two groups from different providers'
do
...
...
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