Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
92da3222
Commit
92da3222
authored
Nov 30, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract on-call schedules license check
Extract on-call schedules license check into policy and a single method
parent
5890106c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
14 deletions
+49
-14
ee/app/finders/incident_management/oncall_schedules_finder.rb
...pp/finders/incident_management/oncall_schedules_finder.rb
+1
-6
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+1
-2
ee/app/services/incident_management/oncall_schedules/create_service.rb
...es/incident_management/oncall_schedules/create_service.rb
+1
-2
ee/app/services/incident_management/oncall_schedules/destroy_service.rb
...s/incident_management/oncall_schedules/destroy_service.rb
+1
-2
ee/app/services/incident_management/oncall_schedules/update_service.rb
...es/incident_management/oncall_schedules/update_service.rb
+1
-2
ee/lib/gitlab/incident_management.rb
ee/lib/gitlab/incident_management.rb
+10
-0
ee/spec/lib/gitlab/incident_management_spec.rb
ee/spec/lib/gitlab/incident_management_spec.rb
+34
-0
No files found.
ee/app/finders/incident_management/oncall_schedules_finder.rb
View file @
92da3222
...
...
@@ -9,7 +9,7 @@ module IncidentManagement
end
def
execute
return
IncidentManagement
::
OncallSchedule
.
none
unless
a
vailable?
&&
a
llowed?
return
IncidentManagement
::
OncallSchedule
.
none
unless
allowed?
collection
=
project
.
incident_management_oncall_schedules
collection
=
by_iid
(
collection
)
...
...
@@ -21,11 +21,6 @@ module IncidentManagement
attr_reader
:current_user
,
:project
,
:params
def
available?
Feature
.
enabled?
(
:oncall_schedules_mvc
,
project
)
&&
project
.
feature_available?
(
:oncall_schedules
)
end
def
allowed?
Ability
.
allowed?
(
current_user
,
:read_incident_management_oncall_schedule
,
project
)
end
...
...
ee/app/policies/ee/project_policy.rb
View file @
92da3222
...
...
@@ -155,8 +155,7 @@ module EE
with_scope
:subject
condition
(
:oncall_schedules_available
)
do
::
Feature
.
enabled?
(
:oncall_schedules_mvc
,
@subject
)
&&
@subject
.
feature_available?
(
:oncall_schedules
)
::
Gitlab
::
IncidentManagement
.
oncall_schedules_available?
(
@subject
)
end
rule
{
visual_review_bot
}.
policy
do
...
...
ee/app/services/incident_management/oncall_schedules/create_service.rb
View file @
92da3222
...
...
@@ -31,8 +31,7 @@ module IncidentManagement
end
def
available?
Feature
.
enabled?
(
:oncall_schedules_mvc
,
project
)
&&
project
.
feature_available?
(
:oncall_schedules
)
::
Gitlab
::
IncidentManagement
.
oncall_schedules_available?
(
project
)
end
def
error
(
message
)
...
...
ee/app/services/incident_management/oncall_schedules/destroy_service.rb
View file @
92da3222
...
...
@@ -31,8 +31,7 @@ module IncidentManagement
end
def
available?
Feature
.
enabled?
(
:oncall_schedules_mvc
,
project
)
&&
project
.
feature_available?
(
:oncall_schedules
)
::
Gitlab
::
IncidentManagement
.
oncall_schedules_available?
(
project
)
end
def
error
(
message
)
...
...
ee/app/services/incident_management/oncall_schedules/update_service.rb
View file @
92da3222
...
...
@@ -33,8 +33,7 @@ module IncidentManagement
end
def
available?
Feature
.
enabled?
(
:oncall_schedules_mvc
,
project
)
&&
project
.
feature_available?
(
:oncall_schedules
)
::
Gitlab
::
IncidentManagement
.
oncall_schedules_available?
(
project
)
end
def
error
(
message
)
...
...
ee/lib/gitlab/incident_management.rb
0 → 100644
View file @
92da3222
# frozen_string_literal: true
module
Gitlab
module
IncidentManagement
def
self
.
oncall_schedules_available?
(
project
)
::
Feature
.
enabled?
(
:oncall_schedules_mvc
,
project
)
&&
project
.
feature_available?
(
:oncall_schedules
)
end
end
end
ee/spec/lib/gitlab/incident_management_spec.rb
0 → 100644
View file @
92da3222
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
IncidentManagement
do
let_it_be_with_refind
(
:project
)
{
create
(
:project
)
}
describe
'.oncall_schedules_available?'
do
subject
{
described_class
.
oncall_schedules_available?
(
project
)
}
before
do
stub_licensed_features
(
oncall_schedules:
true
)
stub_feature_flags
(
oncall_schedules_mvc:
project
)
end
it
{
is_expected
.
to
be_truthy
}
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
oncall_schedules_mvc:
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
context
'when there is no license'
do
before
do
stub_licensed_features
(
oncall_schedules:
false
)
end
it
{
is_expected
.
to
be_falsey
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment