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
6df5662c
Commit
6df5662c
authored
Dec 30, 2020
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add minimal access egde case to ldap override endpoint
parent
ec056fa7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
ee/app/controllers/ee/groups/group_members_controller.rb
ee/app/controllers/ee/groups/group_members_controller.rb
+1
-1
ee/spec/controllers/groups/group_members_controller_spec.rb
ee/spec/controllers/groups/group_members_controller_spec.rb
+37
-1
No files found.
ee/app/controllers/ee/groups/group_members_controller.rb
View file @
6df5662c
...
...
@@ -26,7 +26,7 @@ module EE
# rubocop:disable Gitlab/ModuleWithInstanceVariables
# rubocop: disable CodeReuse/ActiveRecord
def
override
member
=
@group
.
members
.
find_by!
(
id:
params
[
:id
])
member
=
membershipable_
members
.
find_by!
(
id:
params
[
:id
])
updated_member
=
::
Members
::
UpdateService
.
new
(
current_user
,
override_params
)
.
execute
(
member
,
permission: :override
)
...
...
ee/spec/controllers/groups/group_members_controller_spec.rb
View file @
6df5662c
...
...
@@ -60,10 +60,44 @@ RSpec.describe Groups::GroupMembersController do
describe
'POST #override'
do
let
(
:group
)
{
create
(
:group_with_ldap_group_link
)
}
it
'is successful'
do
before
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:override_group_member
,
membership
)
{
true
}
end
it
'is successful'
do
post
:override
,
params:
{
group_id:
group
,
id:
membership
,
group_member:
{
override:
true
}
},
format: :js
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
context
'when user has minimal access'
do
let
(
:membership
)
{
create
(
:group_member
,
:minimal_access
,
source:
group
,
user:
create
(
:user
))
}
it
'is not successful'
do
post
:override
,
params:
{
group_id:
group
,
id:
membership
,
group_member:
{
override:
true
}
},
format: :js
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
context
'when minimal_access_role feature is available'
do
before
do
stub_licensed_features
(
minimal_access_role:
true
)
end
it
'is successful'
do
post
:override
,
params:
{
group_id:
group
,
...
...
@@ -76,6 +110,8 @@ RSpec.describe Groups::GroupMembersController do
end
end
end
end
end
describe
'POST request_access'
do
before
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