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
aa6837cf
Commit
aa6837cf
authored
Sep 24, 2019
by
Tetiana Chupryna
Committed by
James Lopez
Sep 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add permission for License compliance view
parent
5731c5b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
0 deletions
+66
-0
ee/app/models/license.rb
ee/app/models/license.rb
+1
-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
+58
-0
No files found.
ee/app/models/license.rb
View file @
aa6837cf
...
...
@@ -105,6 +105,7 @@ class License < ApplicationRecord
group_ip_restriction
incident_management
insights
licenses_list
license_management
pod_logs
prometheus_alerts
...
...
ee/app/policies/ee/project_policy.rb
View file @
aa6837cf
...
...
@@ -79,6 +79,11 @@ module EE
@subject
.
feature_available?
(
:dependency_list
)
end
with_scope
:subject
condition
(
:licenses_list_enabled
)
do
@subject
.
feature_available?
(
:licenses_list
)
end
with_scope
:subject
condition
(
:feature_flags_disabled
)
do
!
@subject
.
feature_available?
(
:feature_flags
)
...
...
@@ -153,6 +158,8 @@ module EE
rule
{
dependency_list_enabled
&
can?
(
:download_code
)
}.
enable
:read_dependencies
rule
{
licenses_list_enabled
&
can?
(
:read_software_license_policy
)
}.
enable
:read_licenses_list
rule
{
repository_mirrors_enabled
&
((
mirror_available
&
can?
(
:admin_project
))
|
admin
)
}.
enable
:admin_mirror
rule
{
deploy_board_disabled
&
~
is_development
}.
prevent
:read_deploy_board
...
...
ee/spec/policies/project_policy_spec.rb
View file @
aa6837cf
...
...
@@ -730,6 +730,64 @@ describe ProjectPolicy do
end
end
describe
'read_licenses_list'
do
context
'when licenses list feature available'
do
context
'when license management feature available'
do
before
do
stub_licensed_features
(
licenses_list:
true
,
license_management:
true
)
end
context
'with public project'
do
let
(
:current_user
)
{
create
(
:user
)
}
context
'with public access to repository'
do
it
{
is_expected
.
to
be_allowed
(
:read_licenses_list
)
}
end
end
context
'with private project'
do
let
(
:project
)
{
create
(
:project
,
:private
,
namespace:
owner
.
namespace
)
}
where
(
role:
%w[admin owner maintainer developer reporter guest]
)
with_them
do
let
(
:current_user
)
{
public_send
(
role
)
}
it
{
is_expected
.
to
be_allowed
(
:read_licenses_list
)
}
end
context
'with not member'
do
let
(
:current_user
)
{
create
(
:user
)
}
it
{
is_expected
.
to
be_disallowed
(
:read_licenses_list
)
}
end
context
'with anonymous'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_disallowed
(
:read_licenses_list
)
}
end
end
end
context
'when license management feature in not available'
do
let
(
:current_user
)
{
admin
}
before
do
stub_licensed_features
(
licenses_list:
true
)
end
it
{
is_expected
.
to
be_disallowed
(
:read_licenses_list
)
}
end
end
context
'when licenses list feature not available'
do
let
(
:current_user
)
{
admin
}
it
{
is_expected
.
to
be_disallowed
(
:read_licenses_list
)
}
end
end
describe
'create_web_ide_terminal'
do
before
do
stub_licensed_features
(
web_ide_terminal:
true
)
...
...
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