From 3173f909ce49d67a11ab2230cf09629f7e259b74 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 6 Jun 2013 15:37:15 -0400 Subject: [PATCH] add authorized_keys --- .../javascripts/authorized_keys.js.coffee | 3 ++ .../stylesheets/authorized_keys.css.scss | 3 ++ .../app/controllers/application_controller.rb | 1 + .../controllers/authorized_keys_controller.rb | 2 + .../app/helpers/authorized_keys_helper.rb | 2 + apps/workbench/app/models/authorized_key.rb | 2 + .../app/views/authorized_keys/index.html.erb | 49 +++++++++++++++++++ .../app/views/layouts/application.html.erb | 1 + apps/workbench/config/routes.rb | 3 ++ .../test/fixtures/authorized_keys.yml | 11 +++++ .../authorized_keys_controller_test.rb | 7 +++ .../test/unit/authorized_key_test.rb | 7 +++ .../helpers/authorized_keys_helper_test.rb | 4 ++ 13 files changed, 95 insertions(+) create mode 100644 apps/workbench/app/assets/javascripts/authorized_keys.js.coffee create mode 100644 apps/workbench/app/assets/stylesheets/authorized_keys.css.scss create mode 100644 apps/workbench/app/controllers/authorized_keys_controller.rb create mode 100644 apps/workbench/app/helpers/authorized_keys_helper.rb create mode 100644 apps/workbench/app/models/authorized_key.rb create mode 100644 apps/workbench/app/views/authorized_keys/index.html.erb create mode 100644 apps/workbench/test/fixtures/authorized_keys.yml create mode 100644 apps/workbench/test/functional/authorized_keys_controller_test.rb create mode 100644 apps/workbench/test/unit/authorized_key_test.rb create mode 100644 apps/workbench/test/unit/helpers/authorized_keys_helper_test.rb diff --git a/apps/workbench/app/assets/javascripts/authorized_keys.js.coffee b/apps/workbench/app/assets/javascripts/authorized_keys.js.coffee new file mode 100644 index 0000000000..761567942f --- /dev/null +++ b/apps/workbench/app/assets/javascripts/authorized_keys.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/apps/workbench/app/assets/stylesheets/authorized_keys.css.scss b/apps/workbench/app/assets/stylesheets/authorized_keys.css.scss new file mode 100644 index 0000000000..7298460d52 --- /dev/null +++ b/apps/workbench/app/assets/stylesheets/authorized_keys.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the AuthorizedKeys controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index 07b7a2a1df..619c4b52a7 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -51,6 +51,7 @@ class ApplicationController < ActionController::Base @objects ||= model_class.all respond_to do |f| f.json { render json: @objects } + f.html { render } end end diff --git a/apps/workbench/app/controllers/authorized_keys_controller.rb b/apps/workbench/app/controllers/authorized_keys_controller.rb new file mode 100644 index 0000000000..ec8d2415d1 --- /dev/null +++ b/apps/workbench/app/controllers/authorized_keys_controller.rb @@ -0,0 +1,2 @@ +class AuthorizedKeysController < ApplicationController +end diff --git a/apps/workbench/app/helpers/authorized_keys_helper.rb b/apps/workbench/app/helpers/authorized_keys_helper.rb new file mode 100644 index 0000000000..9a486f28ae --- /dev/null +++ b/apps/workbench/app/helpers/authorized_keys_helper.rb @@ -0,0 +1,2 @@ +module AuthorizedKeysHelper +end diff --git a/apps/workbench/app/models/authorized_key.rb b/apps/workbench/app/models/authorized_key.rb new file mode 100644 index 0000000000..a56021682c --- /dev/null +++ b/apps/workbench/app/models/authorized_key.rb @@ -0,0 +1,2 @@ +class AuthorizedKey < ArvadosBase +end diff --git a/apps/workbench/app/views/authorized_keys/index.html.erb b/apps/workbench/app/views/authorized_keys/index.html.erb new file mode 100644 index 0000000000..a02ebc3d1b --- /dev/null +++ b/apps/workbench/app/views/authorized_keys/index.html.erb @@ -0,0 +1,49 @@ + + + + + + + + + <% @objects.sort_by { |ak| ak[:created_at] }.reverse.each do |g| %> + + + + + + <% end %> + <% if @objects.count == 0 %> + + + + <% end %> + + +
+ id + + owner + + name + + key_type + + public_key + + expires_at +
+ <%= link_to_if_arvados_object ak %> + + <%= ak.owner %> + + <%= ak.name %> + + <%= ak.key_type %> + + <%= ak.public_key %> + + <%= ak.expires_at %> +
+ (no authorized keys) +
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb index c11013f418..57c4ace671 100644 --- a/apps/workbench/app/views/layouts/application.html.erb +++ b/apps/workbench/app/views/layouts/application.html.erb @@ -33,6 +33,7 @@