606a1d2d31
Root namespaces have storage statistics. This commit allows namespace owners to get those stats via GraphQL queries like the following one { namespace(fullPath: "a_namespace_path") { rootStorageStatistics { storageSize repositorySize lfsObjectsSize buildArtifactsSize packagesSize wikiSize } } }
18 lines
552 B
Ruby
18 lines
552 B
Ruby
# frozen_string_literal: true
|
|
|
|
class NamespacePolicy < BasePolicy
|
|
rule { anonymous }.prevent_all
|
|
|
|
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
|
|
enable :read_namespace
|
|
enable :read_statistics
|
|
end
|
|
|
|
rule { personal_project & ~can_create_personal_project }.prevent :create_projects
|
|
end
|