From b9ce584056c53253ef5c8fd19f30c20cb521b0b8 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Fri, 12 Sep 2014 10:25:55 -0400 Subject: [PATCH] 3605: Provide "info" field to all requesters. Filters out any keys with text "secret" to non-admin users. Also fix fiddlesticks on workbench viewing details for node. --- .../app/views/application/_arvados_attr_value.html.erb | 2 +- services/api/app/models/node.rb | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/workbench/app/views/application/_arvados_attr_value.html.erb b/apps/workbench/app/views/application/_arvados_attr_value.html.erb index 52c46fbe2f..3df892fd5a 100644 --- a/apps/workbench/app/views/application/_arvados_attr_value.html.erb +++ b/apps/workbench/app/views/application/_arvados_attr_value.html.erb @@ -3,7 +3,7 @@ <%= message %>
<% end %> <% else %> - <% if obj.attribute_editable?(attr) and (!defined?(editable) || editable) %> + <% if attr and obj.attribute_editable?(attr) and (!defined?(editable) || editable) %> <% if resource_class_for_uuid(attrvalue, {referring_object: obj, referring_attr: attr}) %> <%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: obj, with_class_name: true, friendly_name: true} %>
diff --git a/services/api/app/models/node.rb b/services/api/app/models/node.rb index 71d4dea2c0..960142e977 100644 --- a/services/api/app/models/node.rb +++ b/services/api/app/models/node.rb @@ -20,16 +20,19 @@ class Node < ArvadosModel t.add :slot_number t.add :status t.add :crunch_worker_state + t.add :info end api_accessible :superuser, :extend => :user do |t| t.add :first_ping_at - t.add :info t.add lambda { |x| @@nameservers }, :as => :nameservers end def info - @info ||= Hash.new - super + if current_user.andand.current_user.is_admin + super + else + super.select { |k| not k.to_s.include? "secret" } + end end def domain -- 2.30.2