Fix user limiting filter condition
All checks were successful
ci/woodpecker/push/docker Pipeline was successful
All checks were successful
ci/woodpecker/push/docker Pipeline was successful
This commit is contained in:
parent
e5c5e94989
commit
46b5040099
2 changed files with 4 additions and 4 deletions
|
@ -42,7 +42,7 @@ async def get_id_token(
|
|||
id_token = result.scalars().first()
|
||||
if id_token == None:
|
||||
raise HTTPException(status_code=404, detail="IdToken not found")
|
||||
if token.role != Role.ADMINISTRATOR & id_token.owner_id != token.subject:
|
||||
if token.role != Role.ADMINISTRATOR and id_token.owner_id != token.subject:
|
||||
raise HTTPException(status_code=404, detail="IdToken not found")
|
||||
return id_token
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ async def get_transaction(
|
|||
transaction = result.scalars().first()
|
||||
if transaction == None:
|
||||
raise HTTPException(404, "Transaction not found")
|
||||
if token.role != Role.ADMINISTRATOR & transaction.user_id != token.subject:
|
||||
if token.role != Role.ADMINISTRATOR and transaction.user_id != token.subject:
|
||||
raise HTTPException(404, "Transaction not found")
|
||||
return transaction
|
||||
|
||||
|
@ -59,7 +59,7 @@ async def get_transaction_meter_values(
|
|||
transaction = result.scalars().first()
|
||||
if transaction == None:
|
||||
raise HTTPException(404, "Transaction not found")
|
||||
if token.role != Role.ADMINISTRATOR & transaction.user_id != token.subject:
|
||||
if token.role != Role.ADMINISTRATOR and transaction.user_id != token.subject:
|
||||
raise HTTPException(404, "Transaction not found")
|
||||
stmt = select(DbMeterValue).where(DbMeterValue.transaction_id == transaction_id).order_by(DbMeterValue.timestamp)
|
||||
result = db.execute(stmt)
|
||||
|
@ -76,7 +76,7 @@ async def remote_stop_transaction(
|
|||
transaction = result.scalars().first()
|
||||
if transaction == None:
|
||||
raise HTTPException(404, "Transaction not found")
|
||||
if token.role != Role.ADMINISTRATOR & transaction.user_id != token.subject:
|
||||
if token.role != Role.ADMINISTRATOR and transaction.user_id != token.subject:
|
||||
raise HTTPException(404, "Transaction not found")
|
||||
if transaction.status != TransactionStatus.ONGOING:
|
||||
raise HTTPException(status_code=422, detail=[{
|
||||
|
|
Loading…
Add table
Reference in a new issue