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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
4485f376
Commit
4485f376
authored
Apr 26, 2016
by
Borja Aparicio
Committed by
Robert Speicher
May 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set KRB5 as default clone URL when Kerberos is enabled and user is logged in
parent
4adde438
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
24 deletions
+60
-24
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/helpers/button_helper.rb
app/helpers/button_helper.rb
+7
-8
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+7
-2
app/views/shared/_clone_panel.html.haml
app/views/shared/_clone_panel.html.haml
+1
-2
features/project/create.feature
features/project/create.feature
+15
-4
features/steps/project/create.rb
features/steps/project/create.rb
+15
-3
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+14
-5
No files found.
CHANGELOG-EE
View file @
4485f376
...
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.8.0 (unreleased)
- [Elastic] Database indexer prints its status
- [Elastic][Fix] Database indexer skips projects with invalid HEAD reference
- Set KRB5 as default clone protocol when Kerberos is enabled and user is logged in (Borja Aparicio)
v 8.7.2
- Fix MR notifications for slack and hipchat when approvals are fullfiled. !325
...
...
app/helpers/button_helper.rb
View file @
4485f376
...
...
@@ -55,18 +55,17 @@ module ButtonHelper
end
def
kerberos_clone_button
(
project
)
klass
=
'btn js-protocol-switch'
klass
<<
' active'
if
default_clone_protocol
==
'kerberos'
klass
=
'kerberos-selector'
klass
<<
' has-tooltip'
content_tag
:
button
,
'KRB5'
,
content_tag
:
a
,
'KRB5'
,
class:
klass
,
href:
project
.
kerberos_url_to_repo
,
data:
{
clone:
project
.
kerberos_url_to_repo
,
container:
'body'
,
html:
'true'
,
title:
'Get a Kerberos token for your account with kinit<br>to pull or push via Kerberos.'
},
type: :button
placement:
'right'
,
container:
'body'
,
title:
'Get a Kerberos token for your<br>account with kinit.'
}
end
end
app/helpers/projects_helper.rb
View file @
4485f376
...
...
@@ -209,7 +209,10 @@ module ProjectsHelper
end
def
default_url_to_repo
(
project
=
@project
)
if
default_clone_protocol
==
"ssh"
case
default_clone_protocol
when
'krb5'
project
.
kerberos_url_to_repo
when
'ssh'
project
.
ssh_url_to_repo
else
project
.
http_url_to_repo
...
...
@@ -217,7 +220,9 @@ module ProjectsHelper
end
def
default_clone_protocol
if
!
current_user
||
current_user
.
require_ssh_key?
if
alternative_kerberos_url?
&&
current_user
"krb5"
elsif
!
current_user
||
current_user
.
require_ssh_key?
gitlab_config
.
protocol
else
"ssh"
...
...
app/views/shared/_clone_panel.html.haml
View file @
4485f376
...
...
@@ -13,8 +13,7 @@
=
http_clone_button
(
project
)
-
if
alternative_kerberos_url?
%li
%a
#kerberos-btn
{
href:
@project
.
kerberos_url_to_repo
}
KRB5
=
kerberos_clone_button
(
project
)
=
text_field_tag
:project_clone
,
default_url_to_repo
(
project
),
class:
"js-select-on-focus form-control"
,
readonly:
true
.input-group-btn
...
...
features/project/create.feature
View file @
4485f376
...
...
@@ -5,13 +5,24 @@ Feature: Project Create
Should be able to create a new one
@javascript
Scenario
:
User create a project
Scenario
:
User create a project
with Kerberos disabled
Given
I sign in as a user
And
KRB5 disabled
When
I visit new project page
And
I have an ssh key
And
fill project form with valid data
Then
I should see project page
And
I should see empty project instructions
@javascript
Scenario
:
User create a project with Kerberos enabled
Given
I sign in as a user
And
KRB5 enabled
When
I visit new project page
And
I have an ssh key
And
fill project form with valid data
Then
I should see project page
And
I should see empty project inst
uctions
And
I should see empty project inst
ructions with Kerberos as default url
@javascript
Scenario
:
Empty project instructions with Kerberos disabled
...
...
@@ -20,7 +31,7 @@ Feature: Project Create
And
I have an ssh key
When
I visit new project page
And
fill project form with valid data
Then
I see empty project instuctions
Then
I see empty project inst
r
uctions
And
I click on HTTP
Then
Remote url should update to http link
And
If I click on SSH
...
...
@@ -33,7 +44,7 @@ Feature: Project Create
And
I have an ssh key
When
I visit new project page
And
fill project form with valid data
Then
I see empty project inst
uctions
Then
I see empty project inst
ructions with Kerberos as default url
And
I click on HTTP
Then
Remote url should update to http link
And
If I click on SSH
...
...
features/steps/project/create.rb
View file @
4485f376
...
...
@@ -13,12 +13,18 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
expect
(
current_path
).
to
eq
namespace_project_path
(
Project
.
last
.
namespace
,
Project
.
last
)
end
step
'I should see empty project instuctions'
do
step
'I should see empty project inst
r
uctions'
do
expect
(
page
).
to
have_content
"git init"
expect
(
page
).
to
have_content
"git remote"
expect
(
page
).
to
have_content
Project
.
last
.
url_to_repo
end
step
'I should see empty project instructions with Kerberos as default url'
do
expect
(
page
).
to
have_content
"git init"
expect
(
page
).
to
have_content
"git remote"
expect
(
page
).
to
have_content
Project
.
last
.
kerberos_url_to_repo
end
step
'KRB5 enabled'
do
# Enable Kerberos in an alternative port to force Kerberos button and URL to show up in the UI
allow
(
Gitlab
.
config
.
kerberos
).
to
receive
(
:enabled
).
and_return
(
true
)
...
...
@@ -29,12 +35,18 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
allow
(
Gitlab
.
config
.
kerberos
).
to
receive
(
:enabled
).
and_return
(
false
)
end
step
'I see empty project instuctions'
do
step
'I see empty project inst
r
uctions'
do
expect
(
page
).
to
have_content
"git init"
expect
(
page
).
to
have_content
"git remote"
expect
(
page
).
to
have_content
Project
.
last
.
url_to_repo
end
step
'I see empty project instructions with Kerberos as default url'
do
expect
(
page
).
to
have_content
"git init"
expect
(
page
).
to
have_content
"git remote"
expect
(
page
).
to
have_content
Project
.
last
.
kerberos_url_to_repo
end
step
'I click on HTTP'
do
find
(
'#clone-dropdown'
).
click
find
(
'.http-selector'
).
click
...
...
@@ -55,7 +67,7 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
step
'If I click on KRB5'
do
find
(
'#clone-dropdown'
).
click
find
(
'
#kerberos-btn
'
).
click
find
(
'
.kerberos-selector
'
).
click
end
step
'Remote url should update to kerberos link'
do
...
...
spec/helpers/projects_helper_spec.rb
View file @
4485f376
...
...
@@ -88,22 +88,31 @@ describe ProjectsHelper do
end
describe
'default_clone_protocol'
do
describe
'using
HTTP'
do
context
'when user is not logged in and gitlab protocol is
HTTP'
do
it
'returns HTTP'
do
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
expect
(
helper
.
send
(
:default_clone_protocol
)).
to
eq
(
'http'
)
end
end
describe
'using
HTTPS'
do
context
'when user is not logged in and gitlab protocol is
HTTPS'
do
it
'returns HTTPS'
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:protocol
).
and_return
(
'https'
)
expect
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
stub_config_setting
(
protocol:
'https'
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
expect
(
helper
.
send
(
:default_clone_protocol
)).
to
eq
(
'https'
)
end
end
context
'when gitlab.config.kerberos is enabled and user is logged in'
do
it
'returns krb5 as default protocol'
do
allow
(
Gitlab
.
config
.
kerberos
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
double
)
expect
(
helper
.
send
(
:default_clone_protocol
)).
to
eq
(
'krb5'
)
end
end
end
describe
'#license_short_name'
do
...
...
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