2016-08-24 12:49:21 +05:30
|
|
|
module Members
|
|
|
|
class DestroyService < BaseService
|
|
|
|
attr_accessor :member, :current_user
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
def initialize(member, current_user)
|
|
|
|
@member = member
|
|
|
|
@current_user = current_user
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
unless member && can?(current_user, "destroy_#{member.type.underscore}".to_sym, member)
|
|
|
|
raise Gitlab::Access::AccessDeniedError
|
|
|
|
end
|
2016-09-13 17:45:13 +05:30
|
|
|
AuthorizedDestroyService.new(member, current_user).execute
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|