Welcome to mirror list, hosted at ThFree Co, Russian Federation.

group_project_namespace_shared_policy.rb « namespaces « policies « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bfb1706bc5a49f0ca7796019cf629c2b9265ca49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Namespaces
  class GroupProjectNamespaceSharedPolicy < ::NamespacePolicy
    # As we move policies from ProjectPolicy to ProjectNamespacePolicy,
    # anything common with GroupPolicy but not with UserNamespacePolicy can go in here.
    # See https://gitlab.com/groups/gitlab-org/-/epics/6689

    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
  end
end