2016-06-17 08:06:55 -04:00
|
|
|
module Members
|
|
|
|
class DestroyService < BaseService
|
|
|
|
attr_accessor :member, :current_user
|
|
|
|
|
2016-06-23 11:14:31 -04:00
|
|
|
def initialize(member, current_user)
|
|
|
|
@member = member
|
|
|
|
@current_user = current_user
|
2016-06-17 08:06:55 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2016-06-17 12:59:33 -04:00
|
|
|
unless member && can?(current_user, "destroy_#{member.type.underscore}".to_sym, member)
|
|
|
|
raise Gitlab::Access::AccessDeniedError
|
2016-06-17 08:06:55 -04:00
|
|
|
end
|
2016-08-04 17:34:57 -04:00
|
|
|
AuthorizedDestroyService.new(member, current_user).execute
|
2016-06-17 08:06:55 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|