def save!
self.save or raise Exception.new("Save failed")
end
+
+ def destroy
+ if etag || uuid
+ postdata = { '_method' => 'DELETE' }
+ resp = $arvados_api_client.api(self.class, '/' + uuid, postdata)
+ resp[:etag] && resp[:uuid] && resp
+ else
+ true
+ end
+ end
+
def links(*args)
o = {}
o.merge!(args.pop) if args[-1].is_a? Hash
}
end
+ def self.creatable?
+ current_user
+ end
+
def editable?
(current_user and
(current_user.is_admin or
elsif "uuid owner".index(attr.to_s)
current_user and current_user.is_admin
else
- true
+ current_user and current_user.uuid == owner
end
end
self
end
- def current_user
+ def self.current_user
+ Thread.current[:user] ||= User.current if Thread.current[:arvados_api_token]
Thread.current[:user]
end
+ def current_user
+ self.class.current_user
+ end
end