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
d035d735
Commit
d035d735
authored
Jul 19, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests and fine tweak permission error message
parent
a397a0eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+5
-5
lib/gitlab/user_access.rb
lib/gitlab/user_access.rb
+4
-2
No files found.
app/services/ci/create_pipeline_service.rb
View file @
d035d735
...
@@ -23,16 +23,16 @@ module Ci
...
@@ -23,16 +23,16 @@ module Ci
unless
allowed_to_trigger_pipeline?
(
triggering_user
)
unless
allowed_to_trigger_pipeline?
(
triggering_user
)
if
can?
(
triggering_user
,
:create_pipeline
,
project
)
if
can?
(
triggering_user
,
:create_pipeline
,
project
)
return
error
(
"Insufficient permissions for protected ref '
#{
ref
}
'"
)
if
branch?
||
tag?
return
error
(
"Insufficient permissions for protected ref '
#{
ref
}
'"
)
else
return
error
(
'Reference not found'
)
end
else
else
return
error
(
'Insufficient permissions to create a new pipeline'
)
return
error
(
'Insufficient permissions to create a new pipeline'
)
end
end
end
end
unless
branch?
||
tag?
return
error
(
'Reference not found'
)
end
unless
commit
unless
commit
return
error
(
'Commit not found'
)
return
error
(
'Commit not found'
)
end
end
...
...
lib/gitlab/user_access.rb
View file @
d035d735
...
@@ -94,13 +94,15 @@ module Gitlab
...
@@ -94,13 +94,15 @@ module Gitlab
def
protected_branch_accessible_to?
(
ref
,
action
:)
def
protected_branch_accessible_to?
(
ref
,
action
:)
ProtectedBranch
.
protected_ref_accessible_to?
(
ProtectedBranch
.
protected_ref_accessible_to?
(
ref
,
user
,
action:
action
,
ref
,
user
,
action:
action
,
protected_refs:
project
.
protected_branches
)
protected_refs:
project
.
protected_branches
)
end
end
def
protected_tag_accessible_to?
(
ref
,
action
:)
def
protected_tag_accessible_to?
(
ref
,
action
:)
ProtectedTag
.
protected_ref_accessible_to?
(
ProtectedTag
.
protected_ref_accessible_to?
(
ref
,
user
,
action:
action
,
ref
,
user
,
action:
action
,
protected_refs:
project
.
protected_tags
)
protected_refs:
project
.
protected_tags
)
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