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
5148c8c4
Commit
5148c8c4
authored
Oct 23, 2019
by
Diego Louzán
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename :full_private_access policy ability to :read_all_resources
parent
6fca5c53
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
12 additions
and
12 deletions
+12
-12
app/models/user.rb
app/models/user.rb
+1
-1
app/policies/base_policy.rb
app/policies/base_policy.rb
+2
-2
app/policies/personal_snippet_policy.rb
app/policies/personal_snippet_policy.rb
+1
-1
app/policies/project_snippet_policy.rb
app/policies/project_snippet_policy.rb
+1
-1
ee/app/policies/ee/base_policy.rb
ee/app/policies/ee/base_policy.rb
+1
-1
ee/spec/models/issue_spec.rb
ee/spec/models/issue_spec.rb
+1
-1
ee/spec/policies/base_policy_spec.rb
ee/spec/policies/base_policy_spec.rb
+2
-2
spec/policies/base_policy_spec.rb
spec/policies/base_policy_spec.rb
+3
-3
No files found.
app/models/user.rb
View file @
5148c8c4
...
...
@@ -1454,7 +1454,7 @@ class User < ApplicationRecord
# Does the user have access to all private groups & projects?
# Overridden in EE to also check auditor?
def
full_private_access?
can?
(
:
full_private_acces
s
)
can?
(
:
read_all_resource
s
)
end
def
update_two_factor_requirement
...
...
app/policies/base_policy.rb
View file @
5148c8c4
...
...
@@ -36,11 +36,11 @@ class BasePolicy < DeclarativePolicy::Base
::
Gitlab
::
ExternalAuthorization
.
perform_check?
end
rule
{
external_authorization_enabled
&
~
can?
(
:
full_private_acces
s
)
}.
policy
do
rule
{
external_authorization_enabled
&
~
can?
(
:
read_all_resource
s
)
}.
policy
do
prevent
:read_cross_project
end
rule
{
admin
}.
enable
:
full_private_acces
s
rule
{
admin
}.
enable
:
read_all_resource
s
rule
{
default
}.
enable
:read_cross_project
end
...
...
app/policies/personal_snippet_policy.rb
View file @
5148c8c4
...
...
@@ -30,5 +30,5 @@ class PersonalSnippetPolicy < BasePolicy
rule
{
can?
(
:create_note
)
}.
enable
:award_emoji
rule
{
can?
(
:
full_private_acces
s
)
}.
enable
:read_personal_snippet
rule
{
can?
(
:
read_all_resource
s
)
}.
enable
:read_personal_snippet
end
app/policies/project_snippet_policy.rb
View file @
5148c8c4
...
...
@@ -28,7 +28,7 @@ class ProjectSnippetPolicy < BasePolicy
all?
(
private_snippet
|
(
internal_snippet
&
external_user
),
~
project
.
guest
,
~
is_author
,
~
can?
(
:
full_private_acces
s
))
~
can?
(
:
read_all_resource
s
))
end
.
prevent
:read_project_snippet
rule
{
internal_snippet
&
~
is_author
&
~
admin
}.
policy
do
...
...
ee/app/policies/ee/base_policy.rb
View file @
5148c8c4
...
...
@@ -20,7 +20,7 @@ module EE
with_scope
:global
condition
(
:license_block
)
{
License
.
block_changes?
}
rule
{
auditor
}.
enable
:
full_private_acces
s
rule
{
auditor
}.
enable
:
read_all_resource
s
end
end
end
ee/spec/models/issue_spec.rb
View file @
5148c8c4
...
...
@@ -144,7 +144,7 @@ describe Issue do
describe
'when a user cannot read cross project'
do
it
'only returns issues within the same project'
do
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:
full_private_acces
s
,
:global
).
and_call_original
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:
read_all_resource
s
,
:global
).
and_call_original
expect
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_cross_project
).
and_return
(
false
)
expect
(
authorized_issue_a
.
related_issues
(
user
))
...
...
ee/spec/policies/base_policy_spec.rb
View file @
5148c8c4
...
...
@@ -21,9 +21,9 @@ describe BasePolicy, :do_not_mock_admin_mode do
end
end
describe
'
full private acces
s'
do
describe
'
read all resource
s'
do
it
'allows auditors'
do
is_expected
.
to
be_allowed
(
:
full_private_acces
s
)
is_expected
.
to
be_allowed
(
:
read_all_resource
s
)
end
end
end
spec/policies/base_policy_spec.rb
View file @
5148c8c4
...
...
@@ -60,7 +60,7 @@ describe BasePolicy, :do_not_mock_admin_mode do
subject
{
described_class
.
new
(
current_user
,
nil
)
}
it
{
is_expected
.
not_to
be_allowed
(
:
full_private_acces
s
)
}
it
{
is_expected
.
not_to
be_allowed
(
:
read_all_resource
s
)
}
context
'for admins'
do
let
(
:current_user
)
{
build
(
:admin
)
}
...
...
@@ -68,11 +68,11 @@ describe BasePolicy, :do_not_mock_admin_mode do
it
'allowed when in admin mode'
do
enable_admin_mode!
(
current_user
)
is_expected
.
to
be_allowed
(
:
full_private_acces
s
)
is_expected
.
to
be_allowed
(
:
read_all_resource
s
)
end
it
'prevented when not in admin mode'
do
is_expected
.
not_to
be_allowed
(
:
full_private_acces
s
)
is_expected
.
not_to
be_allowed
(
:
read_all_resource
s
)
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