Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJX Terry <jxterry@protonmail.com>2018-07-24 15:46:19 +0300
committerDouwe Maan <douwe@gitlab.com>2018-07-24 15:46:19 +0300
commit99011a61cf4136c806e7de43fcd55475d2407fa1 (patch)
tree99486b31dc0df1b86db0bb11ec32b05c9bc1fb2d /app/policies/user_policy.rb
parentadc327d3fa72b9f5b9c42c629c99f0a89ca15192 (diff)
Add an option to have a private profile on GitLab
Diffstat (limited to 'app/policies/user_policy.rb')
-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