@@ -13,6 +13,12 @@ def epics_license_available?
13
13
false
14
14
end
15
15
16
+ # Not available in FOSS.
17
+ # This method is Overridden in EE
18
+ def project_work_item_epics_available?
19
+ false
20
+ end
21
+
16
22
# rubocop:disable Cop/UserAdmin -- specifically check the admin attribute
17
23
desc "User can read confidential issues"
18
24
condition ( :can_read_confidential ) do
@@ -47,17 +53,22 @@ def epics_license_available?
47
53
end
48
54
end
49
55
50
- # group level issues license for now is equivalent to epics license. We'll have to migrate epics license to
51
- # work items context once epics are fully migrated to work items.
52
- condition ( :group_level_issues_license_available ) do
53
- epics_license_available?
54
- end
55
-
56
56
# this is temporarily needed until we rollout implementation of move and clone for all work item types
57
57
condition ( :supports_move_and_clone , scope : :subject ) do
58
58
@subject . supports_move_and_clone?
59
59
end
60
60
61
+ condition ( :work_item_type_available , scope : :subject ) do
62
+ if group_issue?
63
+ # For now all work item types at group-level require the epics licensed feature
64
+ epics_license_available?
65
+ elsif @subject . epic_work_item?
66
+ project_work_item_epics_available?
67
+ else
68
+ true
69
+ end
70
+ end
71
+
61
72
rule { group_issue & can? ( :read_group ) } . policy do
62
73
enable :create_note
63
74
end
@@ -168,9 +179,9 @@ def epics_license_available?
168
179
prevent :destroy_issue
169
180
end
170
181
171
- # IMPORTANT: keep the prevent rules as last rules defined in the policy, as these are based on
182
+ # IMPORTANT: keep the prevention rules as last rules defined in the policy, as these are based on
172
183
# all abilities defined up to this point.
173
- rule { group_issue & ~ group_level_issues_license_available } . policy do
184
+ rule { ~ work_item_type_available } . policy do
174
185
prevent ( *::IssuePolicy . ability_map . map . keys )
175
186
end
176
187
end
0 commit comments