diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 19:51:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 19:51:40 +0300 |
commit | aefe6486cf0d193067112b90145083d73b96bfef (patch) | |
tree | 02dbf7d022069b183f34b63e99eb359d7e001ddb /app/presenters | |
parent | 66ebf02c05dc69a65731d61baf28ef3335db2bbf (diff) |
Add latest changes from gitlab-org/security/gitlab@13-6-stable-ee
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/user_presenter.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/presenters/user_presenter.rb b/app/presenters/user_presenter.rb index f201b36346f..0028e6d9ef0 100644 --- a/app/presenters/user_presenter.rb +++ b/app/presenters/user_presenter.rb @@ -2,4 +2,18 @@ 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 |