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
aaaee8ae
Commit
aaaee8ae
authored
Mar 20, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow unauthenticated access to some Branch API GET endpoints
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
691402fb
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
58 deletions
+134
-58
changelogs/unreleased/29662-allow-unauthenticated-branches-api.yml
...s/unreleased/29662-allow-unauthenticated-branches-api.yml
+4
-0
doc/api/branches.md
doc/api/branches.md
+4
-1
lib/api/branches.rb
lib/api/branches.rb
+1
-1
spec/requests/api/branches_spec.rb
spec/requests/api/branches_spec.rb
+125
-56
No files found.
changelogs/unreleased/29662-allow-unauthenticated-branches-api.yml
0 → 100644
View file @
aaaee8ae
---
title
:
Allow unauthenticated access to some Branch API GET endpoints
merge_request
:
author
:
doc/api/branches.md
View file @
aaaee8ae
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
## List repository branches
## List repository branches
Get a list of repository branches from a project, sorted by name alphabetically.
Get a list of repository branches from a project, sorted by name alphabetically.
This endpoint can be accessed without authentication if the repository is
publicly accessible.
```
```
GET /projects/:id/repository/branches
GET /projects/:id/repository/branches
...
@@ -48,7 +50,8 @@ Example response:
...
@@ -48,7 +50,8 @@ Example response:
## Get single repository branch
## Get single repository branch
Get a single project repository branch.
Get a single project repository branch. This endpoint can be accessed without
authentication if the repository is publicly accessible.
```
```
GET /projects/:id/repository/branches/:branch
GET /projects/:id/repository/branches/:branch
...
...
lib/api/branches.rb
View file @
aaaee8ae
...
@@ -4,7 +4,6 @@ module API
...
@@ -4,7 +4,6 @@ module API
class
Branches
<
Grape
::
API
class
Branches
<
Grape
::
API
include
PaginationParams
include
PaginationParams
before
{
authenticate!
}
before
{
authorize!
:download_code
,
user_project
}
before
{
authorize!
:download_code
,
user_project
}
params
do
params
do
...
@@ -102,6 +101,7 @@ module API
...
@@ -102,6 +101,7 @@ module API
end
end
post
":id/repository/branches"
do
post
":id/repository/branches"
do
authorize_push_project
authorize_push_project
result
=
CreateBranchService
.
new
(
user_project
,
current_user
).
result
=
CreateBranchService
.
new
(
user_project
,
current_user
).
execute
(
params
[
:branch
],
params
[
:ref
])
execute
(
params
[
:branch
],
params
[
:ref
])
...
...
spec/requests/api/branches_spec.rb
View file @
aaaee8ae
This diff is collapsed.
Click to expand it.
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