diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-11-22 16:06:42 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-11-22 17:31:27 +0800 |
commit | 28102ec28e1ef3d3203db3d05aa89ab3da234e70 (patch) | |
tree | 522d3d898cdf12f947f4d08f3d5487284eb244dc /app | |
parent | 60fe975452f6781198188ae985bad7329d1aff05 (diff) | |
download | gitlab-ce-28102ec28e1ef3d3203db3d05aa89ab3da234e70.tar.gz |
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!
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/deploy_keys_controller.rb | 2 | ||||
-rw-r--r-- | app/views/admin/deploy_keys/index.html.haml | 6 | ||||
-rw-r--r-- | app/views/admin/deploy_keys/new.html.haml | 8 | ||||
-rw-r--r-- | app/views/projects/deploy_keys/_deploy_key.html.haml | 3 |
4 files changed, 18 insertions, 1 deletions
diff --git a/app/controllers/admin/deploy_keys_controller.rb b/app/controllers/admin/deploy_keys_controller.rb index 6b146712940..4f6a7e9e2cb 100644 --- a/app/controllers/admin/deploy_keys_controller.rb +++ b/app/controllers/admin/deploy_keys_controller.rb @@ -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 diff --git a/app/views/admin/deploy_keys/index.html.haml b/app/views/admin/deploy_keys/index.html.haml index 149593e7f46..dee611ae014 100644 --- a/app/views/admin/deploy_keys/index.html.haml +++ b/app/views/admin/deploy_keys/index.html.haml @@ -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 diff --git a/app/views/admin/deploy_keys/new.html.haml b/app/views/admin/deploy_keys/new.html.haml index 5c410a695bf..96055174ad0 100644 --- a/app/views/admin/deploy_keys/new.html.haml +++ b/app/views/admin/deploy_keys/new.html.haml @@ -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" diff --git a/app/views/projects/deploy_keys/_deploy_key.html.haml b/app/views/projects/deploy_keys/_deploy_key.html.haml index 450aaeb367c..d360f1bab28 100644 --- a/app/views/projects/deploy_keys/_deploy_key.html.haml +++ b/app/views/projects/deploy_keys/_deploy_key.html.haml @@ -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) |