X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e346e5d3bd09f4b9fe66538a825cf866faeb308b..e1e4dd922cc2d2bc9890222cc3aeffce7a00fcda:/services/api/app/models/arvados_model.rb diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb index 09b61413b4..136684d009 100644 --- a/services/api/app/models/arvados_model.rb +++ b/services/api/app/models/arvados_model.rb @@ -22,6 +22,10 @@ class ArvadosModel < ActiveRecord::Base kind.match(/^arvados\#(.+?)(_list|List)?$/)[1].pluralize.classify.constantize rescue nil end + def href + "#{current_api_base}/#{self.class.to_s.pluralize.underscore}/#{self.uuid}" + end + def eager_load_associations self.class.columns.each do |col| re = col.name.match /^(.*)_kind$/ @@ -58,11 +62,11 @@ class ArvadosModel < ActiveRecord::Base logger.warn "Inactive user #{current_user.uuid} tried to update #{self.class.to_s} #{self.uuid_was}" return false end + return true if current_user.is_admin if self.uuid_changed? logger.warn "User #{current_user.uuid} tried to change uuid of #{self.class.to_s} #{self.uuid_was} to #{self.uuid}" return false end - return true if current_user.is_admin if self.owner_uuid_changed? if current_user.uuid == self.owner_uuid or current_user.can? write: self.owner_uuid