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
cdc8962f
Commit
cdc8962f
authored
Jan 15, 2021
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add start_trial policy
parent
716890a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
ee/app/policies/ee/group_policy.rb
ee/app/policies/ee/group_policy.rb
+4
-0
ee/spec/policies/group_policy_spec.rb
ee/spec/policies/group_policy_spec.rb
+31
-0
No files found.
ee/app/policies/ee/group_policy.rb
View file @
cdc8962f
...
...
@@ -117,6 +117,8 @@ module EE
condition
(
:over_storage_limit
,
scope: :subject
)
{
@subject
.
over_storage_limit?
}
condition
(
:eligible_for_trial
,
scope: :subject
)
{
@subject
.
eligible_for_trial?
}
rule
{
public_group
|
logged_in_viewable
}.
policy
do
enable
:read_wiki
enable
:download_wiki_code
...
...
@@ -310,6 +312,8 @@ module EE
rule
{
admin
&
is_gitlab_com
}.
enable
:update_subscription_limit
rule
{
maintainer
&
eligible_for_trial
}.
enable
:start_trial
rule
{
over_storage_limit
}.
policy
do
prevent
:create_projects
prevent
:create_epic
...
...
ee/spec/policies/group_policy_spec.rb
View file @
cdc8962f
...
...
@@ -1395,5 +1395,36 @@ RSpec.describe GroupPolicy do
it
{
is_expected
.
to
(
allowed
?
be_allowed
(
policy
)
:
be_disallowed
(
policy
))
}
end
end
describe
':start_trial'
do
using
RSpec
::
Parameterized
::
TableSyntax
let
(
:policy
)
{
:start_trial
}
where
(
:role
,
:eligible_for_trial
,
:allowed
)
do
:guest
|
true
|
false
:guest
|
false
|
false
:reporter
|
true
|
false
:reporter
|
false
|
false
:developer
|
true
|
false
:developer
|
false
|
false
:maintainer
|
true
|
true
:maintainer
|
false
|
false
:owner
|
true
|
true
:owner
|
false
|
false
:admin
|
true
|
true
:admin
|
false
|
false
end
with_them
do
let
(
:current_user
)
{
public_send
(
role
)
}
before
do
allow
(
group
).
to
receive
(
:eligible_for_trial?
).
and_return
(
eligible_for_trial
)
end
it
{
is_expected
.
to
(
allowed
?
be_allowed
(
policy
)
:
be_disallowed
(
policy
))
}
end
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