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
28102ec2
Commit
28102ec2
authored
Nov 22, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow admin to set keys with write access, and
show write access information when showing the key. TODO: It's ugly right now, need help!
parent
60fe9754
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
3 deletions
+40
-3
deploy_keys_controller.rb
app/controllers/admin/deploy_keys_controller.rb
+1
-1
index.html.haml
app/views/admin/deploy_keys/index.html.haml
+6
-0
new.html.haml
app/views/admin/deploy_keys/new.html.haml
+8
-0
_deploy_key.html.haml
app/views/projects/deploy_keys/_deploy_key.html.haml
+3
-0
deploy_keys.feature
features/admin/deploy_keys.feature
+8
-1
deploy_keys.rb
features/steps/admin/deploy_keys.rb
+14
-1
No files found.
app/controllers/admin/deploy_keys_controller.rb
View file @
28102ec2
...
...
@@ -39,6 +39,6 @@ class Admin::DeployKeysController < Admin::ApplicationController
end
def
deploy_key_params
params
.
require
(
:deploy_key
).
permit
(
:key
,
:title
)
params
.
require
(
:deploy_key
).
permit
(
:key
,
:title
,
:can_push
)
end
end
app/views/admin/deploy_keys/index.html.haml
View file @
28102ec2
...
...
@@ -11,6 +11,7 @@
%tr
%th
Title
%th
Fingerprint
%th
Write access
%th
Added at
%th
%tbody
...
...
@@ -21,6 +22,11 @@
%td
%code
.key-fingerprint
=
deploy_key
.
fingerprint
%td
-
if
deploy_key
.
can_push?
Yes
-
else
No
%td
%span
.cgray
added
#{
time_ago_with_tooltip
(
deploy_key
.
created_at
)
}
%td
...
...
app/views/admin/deploy_keys/new.html.haml
View file @
28102ec2
...
...
@@ -16,6 +16,14 @@
Paste a machine public key here. Read more about how to generate it
=
link_to
"here"
,
help_page_path
(
"ssh/README"
)
=
f
.
text_area
:key
,
class:
"form-control thin_area"
,
rows:
5
.form-group
.control-label
.col-sm-10
=
f
.
label
:can_push
do
=
f
.
check_box
:can_push
%strong
Write access allowed?
%p
.light.append-bottom-0
Allow this key to push to repository as well? (Default only allows pull access.)
.form-actions
=
f
.
submit
'Create'
,
class:
"btn-create btn"
...
...
app/views/projects/deploy_keys/_deploy_key.html.haml
View file @
28102ec2
...
...
@@ -6,6 +6,9 @@
=
deploy_key
.
title
.description
=
deploy_key
.
fingerprint
-
if
deploy_key
.
can_push?
.can-write
Can write
.deploy-key-content.prepend-left-default.deploy-key-projects
-
deploy_key
.
projects
.
each
do
|
project
|
-
if
can?
(
current_user
,
:read_project
,
project
)
...
...
features/admin/deploy_keys.feature
View file @
28102ec2
...
...
@@ -13,4 +13,11 @@ Feature: Admin Deploy Keys
And
I click 'New Deploy Key'
And
I submit new deploy key
Then
I should be on admin deploy keys page
And
I should see newly created deploy key
And
I should see newly created deploy key without write access
Scenario
:
Deploy Keys new with write access
When
I visit admin deploy keys page
And
I click 'New Deploy Key'
And
I submit new deploy key with write access
Then
I should be on admin deploy keys page
And
I should see newly created deploy key with write access
features/steps/admin/deploy_keys.rb
View file @
28102ec2
...
...
@@ -32,12 +32,25 @@ class Spinach::Features::AdminDeployKeys < Spinach::FeatureSteps
click_button
"Create"
end
step
'I submit new deploy key with write access'
do
fill_in
"deploy_key_title"
,
with:
"server"
fill_in
"deploy_key_key"
,
with:
"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
check
"deploy_key_can_push"
click_button
"Create"
end
step
'I should be on admin deploy keys page'
do
expect
(
current_path
).
to
eq
admin_deploy_keys_path
end
step
'I should see newly created deploy key'
do
step
'I should see newly created deploy key without write access'
do
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
expect
(
page
).
to
have_content
(
'No'
)
end
step
'I should see newly created deploy key with write access'
do
expect
(
page
).
to
have_content
(
deploy_key
.
title
)
expect
(
page
).
to
have_content
(
'Yes'
)
end
def
deploy_key
...
...
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