diff options
author | Phil Hughes <me@iamphill.com> | 2017-09-29 14:14:39 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-09-29 14:14:39 +0300 |
commit | 93aa6d04c2e81193d7833890d2281fc1df7d7129 (patch) | |
tree | 166a52d9ffdf1bbd3ef073b88626707e9a1acc16 /app/policies/global_policy.rb | |
parent | 8585ae61e730a48fc0688417b24279c48b59dada (diff) |
moved fork checks into policies
Diffstat (limited to 'app/policies/global_policy.rb')
-rw-r--r-- | app/policies/global_policy.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/policies/global_policy.rb b/app/policies/global_policy.rb index 8f7c01bb71f..64e550d19d0 100644 --- a/app/policies/global_policy.rb +++ b/app/policies/global_policy.rb @@ -11,6 +11,8 @@ class GlobalPolicy < BasePolicy with_options scope: :user, score: 0 condition(:access_locked) { @user.access_locked? } + condition(:can_create_fork, scope: :user) { @user.manageable_namespaces.any? { |namespace| @user.can?(:create_projects, namespace) } } + rule { anonymous }.policy do prevent :log_in prevent :access_api @@ -40,6 +42,10 @@ class GlobalPolicy < BasePolicy enable :create_group end + rule { can_create_fork }.policy do + enable :create_fork + end + rule { access_locked }.policy do prevent :log_in end |