X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/fb95d0d2d09c9537f5bdc503e51cf4f091d02c46..c1966ec1c6a63b81202131ad372bb4b6bc45742c:/services/api/lib/has_uuid.rb diff --git a/services/api/lib/has_uuid.rb b/services/api/lib/has_uuid.rb index 21369d199e..481d27a037 100644 --- a/services/api/lib/has_uuid.rb +++ b/services/api/lib/has_uuid.rb @@ -28,7 +28,17 @@ module HasUuid def assign_uuid return true if !self.respond_to_uuid? - return true if uuid and current_user and current_user.is_admin + if (uuid.is_a?(String) and uuid.length>0 and + current_user and current_user.is_admin) + return true + end self.uuid = self.class.generate_uuid end + + def destroy_permission_links + if uuid + Link.destroy_all(['link_class=? and (head_uuid=? or tail_uuid=?)', + 'permission', uuid, uuid]) + end + end end