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
8f3b901c
Commit
8f3b901c
authored
Apr 04, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed developers_can_push in RepoBranch API entity
parent
5442d903
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
app/models/concerns/protected_ref.rb
app/models/concerns/protected_ref.rb
+6
-0
lib/api/entities.rb
lib/api/entities.rb
+2
-6
No files found.
app/models/concerns/protected_ref.rb
View file @
8f3b901c
...
...
@@ -14,6 +14,12 @@ module ProtectedRef
end
end
def
self
.
developers_can?
(
action
,
ref
)
access_levels_for_ref
(
ref
,
action:
action
).
any?
do
|
access_level
|
access_level
.
access_level
==
Gitlab
::
Access
::
DEVELOPER
end
end
def
self
.
access_levels_for_ref
(
ref
,
action: :push
)
self
.
matching
(
ref
).
map
(
&
:"
#{
action
}
_access_levels"
).
flatten
end
...
...
lib/api/entities.rb
View file @
8f3b901c
...
...
@@ -214,15 +214,11 @@ module API
end
expose
:developers_can_push
do
|
repo_branch
,
options
|
project
=
options
[
:project
]
access_levels
=
project
.
protected_branches
.
access_levels_for_ref
(
repo_branch
.
name
,
:push
)
access_levels
.
any?
{
|
access_level
|
access_level
.
access_level
==
Gitlab
::
Access
::
DEVELOPER
}
options
[
:project
].
protected_branches
.
developers_can?
(
:push
,
repo_branch
.
name
)
end
expose
:developers_can_merge
do
|
repo_branch
,
options
|
project
=
options
[
:project
]
access_levels
=
project
.
protected_branches
.
access_levels_for_ref
(
repo_branch
.
name
,
:merge
)
access_levels
.
any?
{
|
access_level
|
access_level
.
access_level
==
Gitlab
::
Access
::
DEVELOPER
}
options
[
:project
].
protected_branches
.
developers_can?
(
:merge
,
repo_branch
.
name
)
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