debian-mirror-gitlab/app/presenters/user_presenter.rb
2020-12-08 15:28:05 +05:30

19 lines
396 B
Ruby

# frozen_string_literal: true
class UserPresenter < Gitlab::View::Presenter::Delegated
presents :user
def group_memberships
should_be_private? ? GroupMember.none : user.group_members
end
def project_memberships
should_be_private? ? ProjectMember.none : user.project_members
end
private
def should_be_private?
!can?(current_user, :read_user_profile, user)
end
end