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
b4b51441
Commit
b4b51441
authored
Aug 04, 2016
by
Adam Niedzielski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract Members::AuthorizedDestroyService from Members::DestroyService.
parent
9adddebc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
app/services/members/authorized_destroy_service.rb
app/services/members/authorized_destroy_service.rb
+17
-0
app/services/members/destroy_service.rb
app/services/members/destroy_service.rb
+1
-6
No files found.
app/services/members/authorized_destroy_service.rb
0 → 100644
View file @
b4b51441
module
Members
class
AuthorizedDestroyService
<
BaseService
attr_accessor
:member
,
:user
def
initialize
(
member
,
user
=
nil
)
@member
,
@user
=
member
,
user
end
def
execute
member
.
destroy
if
member
.
request?
&&
member
.
user
!=
user
notification_service
.
decline_access_request
(
member
)
end
end
end
end
app/services/members/destroy_service.rb
View file @
b4b51441
...
@@ -10,12 +10,7 @@ module Members
...
@@ -10,12 +10,7 @@ module Members
unless
member
&&
can?
(
current_user
,
"destroy_
#{
member
.
type
.
underscore
}
"
.
to_sym
,
member
)
unless
member
&&
can?
(
current_user
,
"destroy_
#{
member
.
type
.
underscore
}
"
.
to_sym
,
member
)
raise
Gitlab
::
Access
::
AccessDeniedError
raise
Gitlab
::
Access
::
AccessDeniedError
end
end
AuthorizedDestroyService
.
new
(
member
,
current_user
).
execute
member
.
destroy
if
member
.
request?
&&
member
.
user
!=
current_user
notification_service
.
decline_access_request
(
member
)
end
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