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
94996963
Commit
94996963
authored
Sep 22, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inverse condition in Members::ApproveAccessRequestService
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
5dcdf1d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
app/services/members/approve_access_request_service.rb
app/services/members/approve_access_request_service.rb
+3
-3
No files found.
app/services/members/approve_access_request_service.rb
View file @
94996963
...
@@ -14,7 +14,7 @@ module Members
...
@@ -14,7 +14,7 @@ module Members
condition
=
params
[
:user_id
]
?
{
user_id:
params
[
:user_id
]
}
:
{
id:
params
[
:id
]
}
condition
=
params
[
:user_id
]
?
{
user_id:
params
[
:user_id
]
}
:
{
id:
params
[
:id
]
}
access_requester
=
source
.
requesters
.
find_by!
(
condition
)
access_requester
=
source
.
requesters
.
find_by!
(
condition
)
raise
Gitlab
::
Access
::
AccessDeniedError
if
cannot
_update_access_requester?
(
access_requester
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can
_update_access_requester?
(
access_requester
)
access_requester
.
access_level
=
params
[
:access_level
]
if
params
[
:access_level
]
access_requester
.
access_level
=
params
[
:access_level
]
if
params
[
:access_level
]
access_requester
.
accept_request
access_requester
.
accept_request
...
@@ -24,8 +24,8 @@ module Members
...
@@ -24,8 +24,8 @@ module Members
private
private
def
can
not
_update_access_requester?
(
access_requester
)
def
can_update_access_requester?
(
access_requester
)
!
access_requester
||
!
can?
(
current_user
,
action_member_permission
(
:update
,
access_requester
),
access_requester
)
access_requester
&&
can?
(
current_user
,
action_member_permission
(
:update
,
access_requester
),
access_requester
)
end
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