2022-01-26 12:08:38 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Namespaces
|
|
|
|
class GroupProjectNamespaceSharedPolicy < ::NamespacePolicy
|
2022-08-27 11:52:29 +05:30
|
|
|
# As we move policies from ProjectPolicy to ProjectNamespacePolicy,
|
2022-01-26 12:08:38 +05:30
|
|
|
# anything common with GroupPolicy but not with UserNamespacePolicy can go in here.
|
|
|
|
# See https://gitlab.com/groups/gitlab-org/-/epics/6689
|
2022-08-27 11:52:29 +05:30
|
|
|
|
|
|
|
condition(:timelog_categories_enabled, score: 0, scope: :subject) do
|
|
|
|
Feature.enabled?(:timelog_categories, @subject)
|
|
|
|
end
|
|
|
|
|
|
|
|
rule { ~timelog_categories_enabled }.policy do
|
|
|
|
prevent :read_timelog_category
|
|
|
|
end
|
|
|
|
|
|
|
|
rule { can?(:reporter_access) }.policy do
|
|
|
|
enable :read_timelog_category
|
|
|
|
end
|
2023-06-20 00:43:36 +05:30
|
|
|
|
|
|
|
rule { can?(:guest_access) }.policy do
|
|
|
|
enable :create_work_item
|
|
|
|
enable :read_work_item
|
|
|
|
enable :read_issue
|
|
|
|
enable :read_namespace
|
|
|
|
end
|
|
|
|
|
|
|
|
rule { can?(:create_work_item) }.enable :create_task
|
2022-01-26 12:08:38 +05:30
|
|
|
end
|
|
|
|
end
|
2023-06-20 00:43:36 +05:30
|
|
|
|
|
|
|
Namespaces::GroupProjectNamespaceSharedPolicy.prepend_mod
|