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
b3874294
Commit
b3874294
authored
May 16, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor
parent
a738a446
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
app/controllers/projects/git_http_client_controller.rb
app/controllers/projects/git_http_client_controller.rb
+0
-4
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+6
-6
No files found.
app/controllers/projects/git_http_client_controller.rb
View file @
b3874294
...
@@ -152,8 +152,4 @@ class Projects::GitHttpClientController < Projects::ApplicationController
...
@@ -152,8 +152,4 @@ class Projects::GitHttpClientController < Projects::ApplicationController
def
has_authentication_ability?
(
capability
)
def
has_authentication_ability?
(
capability
)
(
authentication_abilities
||
[]).
include?
(
capability
)
(
authentication_abilities
||
[]).
include?
(
capability
)
end
end
def
authentication_project
authentication_result
.
project
end
end
end
spec/lib/gitlab/git_access_spec.rb
View file @
b3874294
...
@@ -23,30 +23,30 @@ describe Gitlab::GitAccess, lib: true do
...
@@ -23,30 +23,30 @@ describe Gitlab::GitAccess, lib: true do
context
'ssh disabled'
do
context
'ssh disabled'
do
before
do
before
do
disable_protocol
(
'ssh'
)
disable_protocol
(
'ssh'
)
@acc
=
Gitlab
::
GitAccess
.
new
(
actor
,
project
,
'ssh'
,
authentication_abilities:
authentication_abilities
)
end
end
it
'blocks ssh git push'
do
it
'blocks ssh git push'
do
expect
(
@acc
.
check
(
'git-receive-pack'
,
'_any'
).
allowed?
).
to
be_falsey
expect
(
access
.
check
(
'git-receive-pack'
,
'_any'
).
allowed?
).
to
be_falsey
end
end
it
'blocks ssh git pull'
do
it
'blocks ssh git pull'
do
expect
(
@acc
.
check
(
'git-upload-pack'
,
'_any'
).
allowed?
).
to
be_falsey
expect
(
access
.
check
(
'git-upload-pack'
,
'_any'
).
allowed?
).
to
be_falsey
end
end
end
end
context
'http disabled'
do
context
'http disabled'
do
let
(
:protocol
)
{
'http'
}
before
do
before
do
disable_protocol
(
'http'
)
disable_protocol
(
'http'
)
@acc
=
Gitlab
::
GitAccess
.
new
(
actor
,
project
,
'http'
,
authentication_abilities:
authentication_abilities
)
end
end
it
'blocks http push'
do
it
'blocks http push'
do
expect
(
@acc
.
check
(
'git-receive-pack'
,
'_any'
).
allowed?
).
to
be_falsey
expect
(
access
.
check
(
'git-receive-pack'
,
'_any'
).
allowed?
).
to
be_falsey
end
end
it
'blocks http git pull'
do
it
'blocks http git pull'
do
expect
(
@acc
.
check
(
'git-upload-pack'
,
'_any'
).
allowed?
).
to
be_falsey
expect
(
access
.
check
(
'git-upload-pack'
,
'_any'
).
allowed?
).
to
be_falsey
end
end
end
end
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