2873: add /permissions API method
[arvados.git] / services / api / app / models / arvados_model.rb
index a6f2e41676213ecb8fb3aef50c5845e736de32d8..ce5f1614ce50d41152085f3a697e723afb9b91f2 100644 (file)
@@ -219,14 +219,6 @@ class ArvadosModel < ActiveRecord::Base
     end
     if new_record?
       return true
-    elsif respond_to? :link_class and link_class == 'permission'
-      # Users are permitted to modify permission links themselves
-      # if they have "manage" permission on the destination object.
-      if current_user.can_manage? head_uuid
-        return true
-      else
-        raise PermissionDeniedError
-      end
     elsif current_user.uuid == self.owner_uuid_was or
         current_user.uuid == self.uuid or
         current_user.can? write: self.owner_uuid_was
@@ -462,6 +454,10 @@ class ArvadosModel < ActiveRecord::Base
     nil
   end
 
+  def self.lookup_by_uuid(uuid)
+    ArvadosModel.resource_class_for_uuid(uuid).find_by_uuid(uuid)
+  end
+
   def log_start_state
     @old_etag = etag
     @old_attributes = logged_attributes