1 class KeepDisk < ArvadosModel
4 include CommonApiTemplate
5 before_validation :ensure_ping_secret
7 api_accessible :user, extend: :common do |t|
20 t.add :service_ssl_flag
24 raise "must have :service_host and :ping_secret" unless o[:service_host] and o[:ping_secret]
26 if o[:ping_secret] != self.ping_secret
27 logger.info "Ping: secret mismatch: received \"#{o[:ping_secret]}\" != \"#{self.ping_secret}\""
31 @bypass_arvados_authorization = true
32 self.update_attributes(o.select { |k,v|
42 ].collect(&:to_s).index k
43 }.merge(last_ping_at: Time.now))
48 def ensure_ping_secret
49 self.ping_secret ||= rand(2**256).to_s(36)
52 def permission_to_update
53 @bypass_arvados_authorization or super
56 def permission_to_create
57 current_user and current_user.is_admin