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
Léo-Paul Géneau
gitlab-ce
Commits
5dcdf1d5
Commit
5dcdf1d5
authored
Sep 09, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure Members::ApproveAccessRequestService can fin a requester by ID
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
b3f0a82f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
+13
-3
app/controllers/concerns/membership_actions.rb
app/controllers/concerns/membership_actions.rb
+1
-1
app/services/members/approve_access_request_service.rb
app/services/members/approve_access_request_service.rb
+2
-1
spec/controllers/groups/group_members_controller_spec.rb
spec/controllers/groups/group_members_controller_spec.rb
+2
-1
spec/services/members/approve_access_request_service_spec.rb
spec/services/members/approve_access_request_service_spec.rb
+8
-0
No files found.
app/controllers/concerns/membership_actions.rb
View file @
5dcdf1d5
...
...
@@ -9,7 +9,7 @@ module MembershipActions
end
def
approve_access_request
Members
::
ApproveAccessRequestService
.
new
(
membershipable
,
current_user
,
user_id:
params
[
:id
]
).
execute
Members
::
ApproveAccessRequestService
.
new
(
membershipable
,
current_user
,
params
).
execute
redirect_to
polymorphic_url
([
membershipable
,
:members
])
end
...
...
app/services/members/approve_access_request_service.rb
View file @
5dcdf1d5
...
...
@@ -11,7 +11,8 @@ module Members
end
def
execute
access_requester
=
source
.
requesters
.
find_by!
(
user_id:
params
[
:user_id
])
condition
=
params
[
:user_id
]
?
{
user_id:
params
[
:user_id
]
}
:
{
id:
params
[
:id
]
}
access_requester
=
source
.
requesters
.
find_by!
(
condition
)
raise
Gitlab
::
Access
::
AccessDeniedError
if
cannot_update_access_requester?
(
access_requester
)
...
...
spec/controllers/groups/group_members_controller_spec.rb
View file @
5dcdf1d5
...
...
@@ -2,9 +2,10 @@ require 'spec_helper'
describe
Groups
::
GroupMembersController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
describe
'#index'
do
let
(
:group
)
{
create
(
:group
)
}
before
do
group
.
add_owner
(
user
)
stub_application_setting
(
restricted_visibility_levels:
[
Gitlab
::
VisibilityLevel
::
PUBLIC
])
...
...
spec/services/members/approve_access_request_service_spec.rb
View file @
5dcdf1d5
...
...
@@ -83,6 +83,14 @@ describe Members::ApproveAccessRequestService, services: true do
it_behaves_like
'a service approving an access request'
do
let
(
:source
)
{
group
}
end
context
'when given a :id'
do
let
(
:params
)
{
{
id:
project
.
requesters
.
find_by!
(
user_id:
access_requester
.
id
).
id
}
}
it_behaves_like
'a service approving an access request'
do
let
(
:source
)
{
project
}
end
end
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