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|
26 raise "must have :service_host and :ping_secret" unless o[:service_host] and o[:ping_secret]
28 if o[:ping_secret] != self.ping_secret
29 logger.info "Ping: secret mismatch: received \"#{o[:ping_secret]}\" != \"#{self.ping_secret}\""
33 @bypass_arvados_authorization = true
34 self.update_attributes(o.select { |k,v|
44 ].collect(&:to_s).index k
45 }.merge(last_ping_at: Time.now))
50 def ensure_ping_secret
51 self.ping_secret ||= rand(2**256).to_s(36)
54 def permission_to_update
55 @bypass_arvados_authorization or super
58 def permission_to_create
59 current_user and current_user.is_admin