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
20 t.add :keep_service_uuid
22 api_accessible :superuser, :extend => :user do |t|
26 def foreign_key_attributes
27 super.reject { |a| a == "filesystem_uuid" }
31 raise "must have :service_host and :ping_secret" unless o[:service_host] and o[:ping_secret]
33 if o[:ping_secret] != self.ping_secret
34 logger.info "Ping: secret mismatch: received \"#{o[:ping_secret]}\" != \"#{self.ping_secret}\""
38 @bypass_arvados_authorization = true
39 self.update_attributes!(o.select { |k,v|
46 ].collect(&:to_s).index k
47 }.merge(last_ping_at: Time.now))
51 KeepService.find_by_uuid(self.keep_service_uuid).andand.service_host
55 KeepService.find_by_uuid(self.keep_service_uuid).andand.service_port
59 KeepService.find_by_uuid(self.keep_service_uuid).andand.service_ssl_flag
64 def ensure_ping_secret
65 self.ping_secret ||= rand(2**256).to_s(36)
68 def permission_to_update
69 @bypass_arvados_authorization or super
72 def permission_to_create
73 current_user and current_user.is_admin