2018-07-24 06:00:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-02 01:01:02 -05:00
|
|
|
class MemberPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
presents :member
|
|
|
|
|
2017-12-05 09:03:16 -05:00
|
|
|
def access_level_roles
|
|
|
|
member.class.access_level_roles
|
|
|
|
end
|
|
|
|
|
2017-03-02 01:01:02 -05:00
|
|
|
def can_resend_invite?
|
|
|
|
invite? &&
|
|
|
|
can?(current_user, admin_member_permission, source)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_update?
|
|
|
|
can?(current_user, update_member_permission, member)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_remove?
|
|
|
|
can?(current_user, destroy_member_permission, member)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_approve?
|
|
|
|
request? && can_update?
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def admin_member_permission
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def update_member_permission
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy_member_permission
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|