summaryrefslogtreecommitdiff
path: root/app/policies/namespace_policy.rb
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-04-06 14:06:42 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2017-06-27 12:44:37 -0700
commit37c401433b76170f0150d70865f1f4584db01fa8 (patch)
tree2da7a4c072b863e0cb927993d8d39e7029d720e4 /app/policies/namespace_policy.rb
parente5aad75a2673b2e4465d311cbd27970d5c81d5f7 (diff)
downloadgitlab-ce-37c401433b76170f0150d70865f1f4584db01fa8.tar.gz
convert all the policies to DeclarativePolicy
Diffstat (limited to 'app/policies/namespace_policy.rb')
-rw-r--r--app/policies/namespace_policy.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/app/policies/namespace_policy.rb b/app/policies/namespace_policy.rb
index 29bb357e00a..85b67f0a237 100644
--- a/app/policies/namespace_policy.rb
+++ b/app/policies/namespace_policy.rb
@@ -1,10 +1,10 @@
class NamespacePolicy < BasePolicy
- def rules
- return unless @user
+ rule { anonymous }.prevent_all
- if @subject.owner == @user || @user.admin?
- can! :create_projects
- can! :admin_namespace
- end
+ condition(:owner) { @subject.owner == @user }
+
+ rule { owner | admin }.policy do
+ enable :create_projects
+ enable :admin_namespace
end
end