summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/user_policy.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb
index d092a2de882..fd5708f742f 100644
--- a/app/policies/user_policy.rb
+++ b/app/policies/user_policy.rb
@@ -13,6 +13,11 @@ class UserPolicy < BasePolicy
desc "The user is blocked"
condition(:blocked_user, scope: :subject, score: 0) { @subject.blocked? }
+ condition(:updating_name_disabled_for_users) do
+ ::Gitlab::CurrentSettings.current_application_settings
+ .updating_name_disabled_for_users
+ end
+
rule { ~restricted_public_level }.enable :read_user
rule { ~anonymous }.enable :read_user
@@ -22,6 +27,8 @@ class UserPolicy < BasePolicy
enable :update_user_status
end
+ rule { can?(:update_user) & ( admin | ~updating_name_disabled_for_users ) }.enable :update_name
+
rule { default }.enable :read_user_profile
rule { (private_profile | blocked_user) & ~(user_is_self | admin) }.prevent :read_user_profile
end