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
Tatuya Kamada
gitlab-ce
Commits
e03d01d0
Commit
e03d01d0
authored
Jul 29, 2013
by
Jakub Zienkiewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract server-side git commands to constants
parent
5e35f216
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
lib/api/internal.rb
lib/api/internal.rb
+7
-3
No files found.
lib/api/internal.rb
View file @
e03d01d0
module
API
# Internal access API
class
Internal
<
Grape
::
API
DOWNLOAD_COMMANDS
=
%w{ git-upload-pack git-upload-archive }
PUSH_COMMANDS
=
%w{ git-receive-pack }
namespace
'internal'
do
#
# Check if ssh key has access to project code
...
...
@@ -26,16 +30,16 @@ module API
if
key
.
is_a?
DeployKey
key
.
projects
.
include?
(
project
)
&&
git_cmd
.
starts_with?
(
'git-upload-'
)
key
.
projects
.
include?
(
project
)
&&
DOWNLOAD_COMMANDS
.
include?
(
git_cmd
)
else
user
=
key
.
user
return
false
if
user
.
blocked?
action
=
case
git_cmd
when
'git-upload-pack'
,
'git-upload-archive'
when
*
DOWNLOAD_COMMANDS
then
:download_code
when
'git-receive-pack'
when
*
PUSH_COMMANDS
then
if
project
.
protected_branch?
(
params
[
:ref
])
:push_code_to_protected_branches
...
...
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