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
Tatuya Kamada
gitlab-ce
Commits
16fe6dc7
Commit
16fe6dc7
authored
Aug 16, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port CommitStatus/Build
parent
09286109
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
1 deletion
+24
-1
app/models/ability.rb
app/models/ability.rb
+2
-1
app/policies/base_policy.rb
app/policies/base_policy.rb
+4
-0
app/policies/ci/build_policy.rb
app/policies/ci/build_policy.rb
+13
-0
app/policies/commit_status_policy.rb
app/policies/commit_status_policy.rb
+5
-0
No files found.
app/models/ability.rb
View file @
16fe6dc7
...
...
@@ -74,7 +74,8 @@ class Ability
when
Issue
then
IssuePolicy
.
abilities
(
user
,
subject
)
when
MergeRequest
then
MergeRequestPolicy
.
abilities
(
user
,
subject
)
when
CommitStatus
then
commit_status_abilities
(
user
,
subject
)
when
Ci
::
Build
then
Ci
::
BuildPolicy
.
abilities
(
user
,
subject
)
when
CommitStatus
then
CommitStatus
.
abilities
(
user
,
subject
)
when
Note
then
note_abilities
(
user
,
subject
)
when
ProjectSnippet
then
project_snippet_abilities
(
user
,
subject
)
when
PersonalSnippet
then
personal_snippet_abilities
(
user
,
subject
)
...
...
app/policies/base_policy.rb
View file @
16fe6dc7
...
...
@@ -30,6 +30,10 @@ class BasePolicy
@can
.
merge
(
BasePolicy
.
class_for
(
new_subject
).
abilities
(
@user
,
new_subject
))
end
def
can?
(
rule
)
@can
.
include?
(
rule
)
&&
!
@cannot
.
include?
(
rule
)
end
def
can!
(
*
rules
)
@can
.
merge
(
rules
)
end
...
...
app/policies/ci/build_policy.rb
0 → 100644
View file @
16fe6dc7
module
Ci
class
BuildPolicy
<
CommitStatusPolicy
def
rules
super
# If we can't read build we should also not have that
# ability when looking at this in context of commit_status
%w(read create update admin)
.
each
do
|
rule
|
cannot!
:"
#{
rule
}
_commit_status"
unless
can?
:"
#{
rule
}
_build"
end
end
end
end
app/policies/commit_status_policy.rb
0 → 100644
View file @
16fe6dc7
class
CommitStatusPolicy
<
BasePolicy
def
rules
delegate!
@subject
.
project
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