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
d4699d09
Commit
d4699d09
authored
Mar 11, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement project policy `publish_status_page`
parent
7f4cd47e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+7
-0
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+47
-0
No files found.
ee/app/policies/ee/project_policy.rb
View file @
d4699d09
...
...
@@ -124,6 +124,11 @@ module EE
@subject
.
feature_available?
(
:code_review_analytics
,
@user
)
end
condition
(
:status_page_available
)
do
@subject
.
feature_available?
(
:status_page
,
@user
)
&&
@subject
.
beta_feature_available?
(
:status_page
)
end
condition
(
:group_timelogs_available
)
do
@subject
.
feature_available?
(
:group_timelogs
)
end
...
...
@@ -235,6 +240,8 @@ module EE
rule
{
prometheus_alerts_enabled
&
can?
(
:maintainer_access
)
}.
enable
:read_prometheus_alerts
rule
{
status_page_available
&
can?
(
:maintainer_access
)
}.
enable
:publish_status_page
rule
{
auditor
}.
policy
do
enable
:public_user_access
prevent
:request_access
...
...
ee/spec/policies/project_policy_spec.rb
View file @
d4699d09
...
...
@@ -1022,6 +1022,53 @@ describe ProjectPolicy do
end
end
describe
'publish_status_page'
do
let
(
:feature
)
{
:status_page
}
let
(
:policy
)
{
:publish_status_page
}
context
'when feature is available'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:role
,
:allowed
)
do
:guest
|
false
:reporter
|
false
:developer
|
false
:maintainer
|
true
:owner
|
true
:admin
|
true
end
with_them
do
let
(
:current_user
)
{
public_send
(
role
)
}
before
do
stub_feature_flags
(
feature
=>
true
)
stub_licensed_features
(
feature
=>
true
)
end
it
do
is_expected
.
to
(
allowed
?
be_allowed
(
policy
)
:
be_disallowed
(
policy
))
end
context
'when feature is not available'
do
before
do
stub_licensed_features
(
feature
=>
false
)
end
it
{
is_expected
.
to
be_disallowed
(
policy
)
}
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
feature
=>
false
)
end
it
{
is_expected
.
to
be_disallowed
(
policy
)
}
end
end
end
end
context
'support bot'
do
let
(
:current_user
)
{
User
.
support_bot
}
...
...
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