1 class KeepDisk < ArvadosModel
4 include CommonApiTemplate
5 before_validation :ensure_ping_secret
7 api_accessible :user, extend: :common do |t|
19 t.add :service_ssl_flag
21 api_accessible :superuser, :extend => :user do |t|
25 def foreign_key_attributes
26 super.reject { |a| a == "filesystem_uuid" }
30 raise "must have :service_host and :ping_secret" unless o[:service_host] and o[:ping_secret]
32 if o[:ping_secret] != self.ping_secret
33 logger.info "Ping: secret mismatch: received \"#{o[:ping_secret]}\" != \"#{self.ping_secret}\""
37 @bypass_arvados_authorization = true
38 self.update_attributes!(o.select { |k,v|
48 ].collect(&:to_s).index k
49 }.merge(last_ping_at: Time.now))
54 def ensure_ping_secret
55 self.ping_secret ||= rand(2**256).to_s(36)
58 def permission_to_update
59 @bypass_arvados_authorization or super
62 def permission_to_create
63 current_user and current_user.is_admin