1 class KeepDisk < ArvadosModel
4 include CommonApiTemplate
5 before_validation :ensure_ping_secret
7 api_accessible :superuser, :extend => :common do |t|
21 raise "must have :service_host and :ping_secret" unless o[:service_host] and o[:ping_secret]
23 if o[:ping_secret] != self.ping_secret
24 logger.info "Ping: secret mismatch: received \"#{o[:ping_secret]}\" != \"#{self.ping_secret}\""
28 @bypass_arvados_authorization = true
29 self.update_attributes(o.select { |k,v|
39 ].collect(&:to_s).index k
40 }.merge(last_ping_at: Time.now))
45 def ensure_ping_secret
46 self.ping_secret ||= rand(2**256).to_s(36)
49 def permission_to_update
50 @bypass_arvados_authorization or super
53 def permission_to_create
54 current_user and current_user.is_admin