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!
This commit is contained in:
parent
60fe975452
commit
28102ec28e
|
@ -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
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
%tr
|
||||
%th Title
|
||||
%th Fingerprint
|
||||
%th Write access
|
||||
%th Added at
|
||||
%th
|
||||
%tbody
|
||||
|
@ -20,6 +21,11 @@
|
|||
%strong= deploy_key.title
|
||||
%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)}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue