fix(acl): add relation

This commit is contained in:
pycook
2024-05-30 09:33:30 +08:00
parent 9ccaaffa4a
commit b0e7748ad0
3 changed files with 14 additions and 7 deletions

View File

@@ -315,9 +315,12 @@ class ResourceCRUD(object):
return resource
@staticmethod
def delete(_id, rebuild=True):
def delete(_id, rebuild=True, app_id=None):
resource = Resource.get_by_id(_id) or abort(404, ErrFormat.resource_not_found.format("id={}".format(_id)))
if app_id is not None and resource.app_id != app_id:
return abort(404, ErrFormat.resource_not_found.format("id={}".format(_id)))
origin = resource.to_dict()
resource.soft_delete()