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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
40900669
Commit
40900669
authored
Jan 24, 2019
by
Patrick Bajao
Committed by
Nick Thomas
Jan 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow admins/auditors to read private personal snippets
parent
16ab0050
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
4 deletions
+19
-4
app/policies/personal_snippet_policy.rb
app/policies/personal_snippet_policy.rb
+2
-0
changelogs/unreleased/51754-admin-view-private-personal-snippets.yml
...unreleased/51754-admin-view-private-personal-snippets.yml
+5
-0
spec/models/event_spec.rb
spec/models/event_spec.rb
+1
-4
spec/policies/personal_snippet_policy_spec.rb
spec/policies/personal_snippet_policy_spec.rb
+11
-0
No files found.
app/policies/personal_snippet_policy.rb
View file @
40900669
...
@@ -29,4 +29,6 @@ class PersonalSnippetPolicy < BasePolicy
...
@@ -29,4 +29,6 @@ class PersonalSnippetPolicy < BasePolicy
rule
{
anonymous
}.
prevent
:comment_personal_snippet
rule
{
anonymous
}.
prevent
:comment_personal_snippet
rule
{
can?
(
:comment_personal_snippet
)
}.
enable
:award_emoji
rule
{
can?
(
:comment_personal_snippet
)
}.
enable
:award_emoji
rule
{
full_private_access
}.
enable
:read_personal_snippet
end
end
changelogs/unreleased/51754-admin-view-private-personal-snippets.yml
0 → 100644
View file @
40900669
---
title
:
Allow users with full private access to read private personal snippets.
merge_request
:
24560
author
:
type
:
fixed
spec/models/event_spec.rb
View file @
40900669
...
@@ -399,10 +399,7 @@ describe Event do
...
@@ -399,10 +399,7 @@ describe Event do
expect
(
event
.
visible_to_user?
(
nil
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
nil
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
non_member
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
non_member
)).
to
be_falsy
expect
(
event
.
visible_to_user?
(
author
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
author
)).
to
be_truthy
expect
(
event
.
visible_to_user?
(
admin
)).
to
be_truthy
# It is very unexpected that a private personal snippet is not visible
# to an instance administrator. This should be fixed in the future.
expect
(
event
.
visible_to_user?
(
admin
)).
to
be_falsy
end
end
end
end
end
end
...
...
spec/policies/personal_snippet_policy_spec.rb
View file @
40900669
...
@@ -128,6 +128,17 @@ describe PersonalSnippetPolicy do
...
@@ -128,6 +128,17 @@ describe PersonalSnippetPolicy do
end
end
end
end
context
'admin user'
do
subject
{
permissions
(
admin_user
)
}
it
do
is_expected
.
to
be_allowed
(
:read_personal_snippet
)
is_expected
.
to
be_disallowed
(
:comment_personal_snippet
)
is_expected
.
to
be_disallowed
(
:award_emoji
)
is_expected
.
to
be_disallowed
(
*
author_permissions
)
end
end
context
'external user'
do
context
'external user'
do
subject
{
permissions
(
external_user
)
}
subject
{
permissions
(
external_user
)
}
...
...
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