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
Léo-Paul Géneau
gitlab-ce
Commits
d87c1d55
Commit
d87c1d55
authored
Aug 16, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port notes and project snippets
parent
3656d3b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
app/policies/note_policy.rb
app/policies/note_policy.rb
+19
-0
app/policies/project_snippet_policy.rb
app/policies/project_snippet_policy.rb
+20
-0
No files found.
app/policies/note_policy.rb
0 → 100644
View file @
d87c1d55
class
NotePolicy
<
BasePolicy
def
rules
delegate!
@subject
.
project
return
unless
@user
if
@subject
.
author
==
@user
can!
:read_note
can!
:update_note
can!
:admin_note
can!
:resolve_note
end
if
@subject
.
for_merge_request?
&&
@subject
.
noteable
.
author
==
@user
can!
:resolve_note
end
end
end
app/policies/project_snippet_policy.rb
0 → 100644
View file @
d87c1d55
class
ProjectSnippetPolicy
<
BasePolicy
def
rules
can!
:read_project_snippet
if
@subject
.
public?
return
unless
@user
if
@user
&&
@subject
.
author
==
@user
||
@user
.
admin?
can!
:read_project_snippet
can!
:update_project_snippet
can!
:admin_project_snippet
end
if
@subject
.
internal?
&&
!
@user
.
external?
can!
:read_project_snippet
end
if
@subject
.
private?
&&
@subject
.
project
.
team
.
member?
(
@user
)
can!
:read_project_snippet
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