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
+ Link.destroy_all(['link_class=? and (head_uuid=? or tail_uuid=?)',
+ 'permission', uuid, uuid])
+ end
end