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
Jérome Perrin
gitlab-ce
Commits
9ab7bdf7
Commit
9ab7bdf7
authored
Dec 01, 2015
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Signed in admin should be able to add/remove himself to a group
parent
1ad8b731
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
4 deletions
+51
-4
app/models/ability.rb
app/models/ability.rb
+2
-4
features/admin/groups.feature
features/admin/groups.feature
+16
-0
features/steps/admin/groups.rb
features/steps/admin/groups.rb
+29
-0
features/steps/shared/group.rb
features/steps/shared/group.rb
+4
-0
No files found.
app/models/ability.rb
View file @
9ab7bdf7
...
@@ -346,12 +346,10 @@ class Ability
...
@@ -346,12 +346,10 @@ class Ability
unless
group
.
last_owner?
(
target_user
)
unless
group
.
last_owner?
(
target_user
)
can_manage
=
group_abilities
(
user
,
group
).
include?
(
:admin_group_member
)
can_manage
=
group_abilities
(
user
,
group
).
include?
(
:admin_group_member
)
if
can_manage
&&
user
!=
target_user
if
can_manage
rules
<<
:update_group_member
rules
<<
:update_group_member
rules
<<
:destroy_group_member
rules
<<
:destroy_group_member
end
elsif
user
==
target_user
if
user
==
target_user
rules
<<
:destroy_group_member
rules
<<
:destroy_group_member
end
end
end
end
...
...
features/admin/groups.feature
View file @
9ab7bdf7
...
@@ -33,3 +33,19 @@ Feature: Admin Groups
...
@@ -33,3 +33,19 @@ Feature: Admin Groups
When
I visit admin group page
When
I visit admin group page
When
I select user
"johndoe@gitlab.com"
from user list as
"Reporter"
When
I select user
"johndoe@gitlab.com"
from user list as
"Reporter"
Then
I should see
"johndoe@gitlab.com"
in team list in every project as
"Reporter"
Then
I should see
"johndoe@gitlab.com"
in team list in every project as
"Reporter"
@javascript
Scenario
:
Signed in admin should be able to add himself to a group
Given
"John Doe"
is owner of group
"Owned"
When
I visit group
"Owned"
members page
When
I select current user as
"Developer"
Then
I should see current user as
"Developer"
@javascript
Scenario
:
Signed in admin should be able to remove himself from group
Given
current user is developer of group
"Owned"
When
I visit group
"Owned"
members page
Then
I should see current user as
"Developer"
When
I click on the
"Remove User From Group"
button for current user
When
I visit group
"Owned"
members page
Then
I should not see current user as
"Developer"
features/steps/admin/groups.rb
View file @
9ab7bdf7
class
Spinach::Features::AdminGroups
<
Spinach
::
FeatureSteps
class
Spinach::Features::AdminGroups
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedAuthentication
include
SharedGroup
include
SharedPaths
include
SharedPaths
include
SharedUser
include
SharedUser
include
SharedActiveTab
include
SharedActiveTab
...
@@ -88,6 +89,34 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
...
@@ -88,6 +89,34 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
end
end
end
end
step
'I select current user as "Developer"'
do
page
.
within
".users-group-form"
do
select2
(
current_user
.
id
,
from:
"#user_ids"
,
multiple:
true
)
select
"Developer"
,
from:
"access_level"
end
click_button
"Add users to group"
end
step
'I should see current user as "Developer"'
do
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
end
step
'I click on the "Remove User From Group" button for current user'
do
find
(
:css
,
'li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
# poltergeist always confirms popups.
end
step
'I should not see current user as "Developer"'
do
page
.
within
'.content-list'
do
expect
(
page
).
not_to
have_content
(
current_user
.
name
)
expect
(
page
).
not_to
have_content
(
'Developer'
)
end
end
protected
protected
def
current_group
def
current_group
...
...
features/steps/shared/group.rb
View file @
9ab7bdf7
module
SharedGroup
module
SharedGroup
include
Spinach
::
DSL
include
Spinach
::
DSL
step
'current user is developer of group "Owned"'
do
is_member_of
(
current_user
.
name
,
"Owned"
,
Gitlab
::
Access
::
DEVELOPER
)
end
step
'"John Doe" is owner of group "Owned"'
do
step
'"John Doe" is owner of group "Owned"'
do
is_member_of
(
"John Doe"
,
"Owned"
,
Gitlab
::
Access
::
OWNER
)
is_member_of
(
"John Doe"
,
"Owned"
,
Gitlab
::
Access
::
OWNER
)
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