summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorJX Terry <jxterry@protonmail.com>2018-07-24 12:46:19 +0000
committerDouwe Maan <douwe@gitlab.com>2018-07-24 12:46:19 +0000
commit99011a61cf4136c806e7de43fcd55475d2407fa1 (patch)
tree99486b31dc0df1b86db0bb11ec32b05c9bc1fb2d /app/policies
parentadc327d3fa72b9f5b9c42c629c99f0a89ca15192 (diff)
downloadgitlab-ce-99011a61cf4136c806e7de43fcd55475d2407fa1.tar.gz
Add an option to have a private profile on GitLab
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/user_policy.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb
index ee219f0a0d0..8499e45e846 100644
--- a/app/policies/user_policy.rb
+++ b/app/policies/user_policy.rb
@@ -5,6 +5,9 @@ class UserPolicy < BasePolicy
desc "This is the ghost user"
condition(:subject_ghost, scope: :subject, score: 0) { @subject.ghost? }
+ desc "The profile is private"
+ condition(:private_profile, scope: :subject, score: 0) { @subject.private_profile? }
+
rule { ~restricted_public_level }.enable :read_user
rule { ~anonymous }.enable :read_user
@@ -12,4 +15,7 @@ class UserPolicy < BasePolicy
enable :destroy_user
enable :update_user
end
+
+ rule { default }.enable :read_user_profile
+ rule { private_profile & ~(user_is_self | admin) }.prevent :read_user_profile
end