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
Boxiang Sun
gitlab-ce
Commits
393b5461
Commit
393b5461
authored
Jun 06, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gitlabhq/gitlabhq
parents
6a147361
8ec42ff8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
lib/api/files.rb
lib/api/files.rb
+8
-1
No files found.
lib/api/files.rb
View file @
393b5461
...
@@ -2,7 +2,6 @@ module API
...
@@ -2,7 +2,6 @@ module API
# Projects API
# Projects API
class
Files
<
Grape
::
API
class
Files
<
Grape
::
API
before
{
authenticate!
}
before
{
authenticate!
}
before
{
authorize!
:push_code
,
user_project
}
resource
:projects
do
resource
:projects
do
# Get file from repository
# Get file from repository
...
@@ -28,6 +27,8 @@ module API
...
@@ -28,6 +27,8 @@ module API
# }
# }
#
#
get
":id/repository/files"
do
get
":id/repository/files"
do
authorize!
:download_code
,
user_project
required_attributes!
[
:file_path
,
:ref
]
required_attributes!
[
:file_path
,
:ref
]
attrs
=
attributes_for_keys
[
:file_path
,
:ref
]
attrs
=
attributes_for_keys
[
:file_path
,
:ref
]
ref
=
attrs
.
delete
(
:ref
)
ref
=
attrs
.
delete
(
:ref
)
...
@@ -68,6 +69,8 @@ module API
...
@@ -68,6 +69,8 @@ module API
# POST /projects/:id/repository/files
# POST /projects/:id/repository/files
#
#
post
":id/repository/files"
do
post
":id/repository/files"
do
authorize!
:push_code
,
user_project
required_attributes!
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
required_attributes!
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
,
:encoding
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
,
:encoding
]
branch_name
=
attrs
.
delete
(
:branch_name
)
branch_name
=
attrs
.
delete
(
:branch_name
)
...
@@ -98,6 +101,8 @@ module API
...
@@ -98,6 +101,8 @@ module API
# PUT /projects/:id/repository/files
# PUT /projects/:id/repository/files
#
#
put
":id/repository/files"
do
put
":id/repository/files"
do
authorize!
:push_code
,
user_project
required_attributes!
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
required_attributes!
[
:file_path
,
:branch_name
,
:content
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
,
:encoding
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:content
,
:commit_message
,
:encoding
]
branch_name
=
attrs
.
delete
(
:branch_name
)
branch_name
=
attrs
.
delete
(
:branch_name
)
...
@@ -128,6 +133,8 @@ module API
...
@@ -128,6 +133,8 @@ module API
# DELETE /projects/:id/repository/files
# DELETE /projects/:id/repository/files
#
#
delete
":id/repository/files"
do
delete
":id/repository/files"
do
authorize!
:push_code
,
user_project
required_attributes!
[
:file_path
,
:branch_name
,
:commit_message
]
required_attributes!
[
:file_path
,
:branch_name
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:commit_message
]
attrs
=
attributes_for_keys
[
:file_path
,
:branch_name
,
:commit_message
]
branch_name
=
attrs
.
delete
(
:branch_name
)
branch_name
=
attrs
.
delete
(
:branch_name
)
...
...
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