gitlab-org--gitlab-foss/app/policies/namespace_policy.rb

15 lines
466 B
Ruby
Raw Normal View History

class NamespacePolicy < BasePolicy
rule { anonymous }.prevent_all
2017-09-29 07:14:39 -04:00
condition(:personal_project, scope: :subject) { @subject.kind == 'user' }
condition(:can_create_personal_project, scope: :user) { @user.can_create_project? }
condition(:owner) { @subject.owner == @user }
rule { owner | admin }.policy do
enable :create_projects
enable :admin_namespace
end
2017-09-29 07:14:39 -04:00
rule { personal_project & ~can_create_personal_project }.prevent :create_projects
end