BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2e6c1720
Commit
2e6c1720
authored
Dec 16, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow Repositories API GET endpoints to be requested anonymously
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
40a6a077
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
4269-public-repositories-api.yml
changelogs/unreleased/4269-public-repositories-api.yml
+4
-0
repositories.md
doc/api/repositories.md
+13
-5
repositories.rb
lib/api/repositories.rb
+0
-6
repositories_spec.rb
spec/requests/api/repositories_spec.rb
+0
-0
No files found.
changelogs/unreleased/4269-public-repositories-api.yml
0 → 100644
View file @
2e6c1720
---
title
:
Allow Repositories API GET endpoints to be requested anonymously
merge_request
:
author
:
doc/api/repositories.md
View file @
2e6c1720
...
...
@@ -2,7 +2,8 @@
## List repository tree
Get a list of repository files and directories in a project.
Get a list of repository files and directories in a project. This endpoint can
be accessed without authentication if the repository is publicly accessible.
```
GET /projects/:id/repository/tree
...
...
@@ -71,7 +72,8 @@ Parameters:
## Raw file content
Get the raw file contents for a file by commit SHA and path.
Get the raw file contents for a file by commit SHA and path. This endpoint can
be accessed without authentication if the repository is publicly accessible.
```
GET /projects/:id/repository/blobs/:sha
...
...
@@ -85,7 +87,8 @@ Parameters:
## Raw blob content
Get the raw file contents for a blob by blob SHA.
Get the raw file contents for a blob by blob SHA. This endpoint can be accessed
without authentication if the repository is publicly accessible.
```
GET /projects/:id/repository/raw_blobs/:sha
...
...
@@ -98,7 +101,8 @@ Parameters:
## Get file archive
Get an archive of the repository
Get an archive of the repository. This endpoint can be accessed without
authentication if the repository is publicly accessible.
```
GET /projects/:id/repository/archive
...
...
@@ -111,6 +115,9 @@ Parameters:
## Compare branches, tags or commits
This endpoint can be accessed without authentication if the repository is
publicly accessible.
```
GET /projects/:id/repository/compare
```
...
...
@@ -163,7 +170,8 @@ Response:
## Contributors
Get repository contributors list
Get repository contributors list. This endpoint can be accessed without
authentication if the repository is publicly accessible.
```
GET /projects/:id/repository/contributors
...
...
lib/api/repositories.rb
View file @
2e6c1720
...
...
@@ -2,7 +2,6 @@ require 'mime/types'
module
API
class
Repositories
<
Grape
::
API
before
{
authenticate!
}
before
{
authorize!
:download_code
,
user_project
}
params
do
...
...
@@ -79,8 +78,6 @@ module API
optional
:format
,
type:
String
,
desc:
'The archive format'
end
get
':id/repository/archive'
,
requirements:
{
format:
Gitlab
::
Regex
.
archive_formats_regex
}
do
authorize!
:download_code
,
user_project
begin
send_git_archive
user_project
.
repository
,
ref:
params
[
:sha
],
format:
params
[
:format
]
rescue
...
...
@@ -96,7 +93,6 @@ module API
requires
:to
,
type:
String
,
desc:
'The commit, branch name, or tag name to stop comparison'
end
get
':id/repository/compare'
do
authorize!
:download_code
,
user_project
compare
=
Gitlab
::
Git
::
Compare
.
new
(
user_project
.
repository
.
raw_repository
,
params
[
:from
],
params
[
:to
])
present
compare
,
with:
Entities
::
Compare
end
...
...
@@ -105,8 +101,6 @@ module API
success
Entities
::
Contributor
end
get
':id/repository/contributors'
do
authorize!
:download_code
,
user_project
begin
present
user_project
.
repository
.
contributors
,
with:
Entities
::
Contributor
...
...
spec/requests/api/repositories_spec.rb
View file @
2e6c1720
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