async def delete_permission( run_id: int, method: str, user_id: str, enforcer: casbin.Enforcer = Depends(get_enforcer), current_user: Auth0ClaimsPatched = Depends(get_current_user)): if not check_access(enforcer, user=current_user.username, path=f"/run/{str(run_id)}", method="PUT"): raise HTTPException(status_code=403, detail='Insufficient Permissions') delete_policy(enforcer, user=user_id, path=f"/run/{run_id}", method=method) return success
def delete(self, protocol_id): purge = request.args.get('purge') == 'true' if request.args.get( 'purge') else False protocol = Protocol.query.get(protocol_id) if not protocol or protocol.is_deleted: abort(404) return if purge: db.session.delete(protocol) else: protocol.is_deleted = True db.session.commit() delete_policy(path=f"/protocol/{str(protocol.id)}") return {'success': True}
def delete(self, run_id): purge = request.args.get('purge') == 'true' if request.args.get( 'purge') else False run = Run.query.get(run_id) if not run or run.is_deleted: abort(404) return if purge: db.session.delete(run) else: run.is_deleted = True # TODO: Mark all samples as deleted/archived? db.session.commit() delete_policy(path=f"/run/{str(run.id)}") return {'success': True}
async def delete_protocol( protocol_id: int, purge: bool = False, enforcer: casbin.Enforcer = Depends(get_enforcer), db: Session = Depends(get_db), current_user: Auth0ClaimsPatched = Depends(get_current_user)): if not check_access(enforcer, user=current_user.username, path=f"/protocol/{str(protocol_id)}", method="DELETE"): raise HTTPException(status_code=403, detail='Insufficient Permissions') protocol = db.query(Protocol).get(protocol_id) if not protocol or protocol.is_deleted: raise HTTPException(status_code=404, detail='Protocol Not Found') if purge: db.delete(protocol) else: protocol.is_deleted = True db.commit() delete_policy(enforcer, path=f"/protocol/{str(protocol.id)}") return success
async def delete_run( run_id: int, purge: bool = False, enforcer: casbin.Enforcer = Depends(get_enforcer), db: Session = Depends(get_db), current_user: Auth0ClaimsPatched = Depends(get_current_user)): if not check_access(enforcer, user=current_user.username, path=f"/run/{str(run_id)}", method="DELETE"): raise HTTPException(status_code=403, detail='Insufficient Permissions') run = db.query(Run).get(run_id) if not run or run.is_deleted: raise HTTPException(status_code=404, detail='Run Not Found') if purge: db.delete(run) else: run.is_deleted = True # TODO: Mark all samples as deleted/archived? db.commit() delete_policy(enforcer, path=f"/run/{str(run.id)}") return success
def delete(self, protocol_id, method, user_id): delete_policy(user=user_id, path=f"/protocol/{protocol_id}", method=method) return {'success': True}
def delete(self, run_id, method, user_id): delete_policy(user=user_id, path=f"/run/{run_id}", method=method) return {'success': True}