Skip to content

Commit

Permalink
Missing attributes on OutgoingTransfers removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Aug 12, 2024
1 parent 6dff620 commit 68f26e7
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions librarian_server/api/checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ def modify_transfers_by_id(
reasons.add("No destination transfer with the appropriate ID was found.")
continue

authorized = (
user.is_admin
or (transfer.source == user.username)
or (transfer.uploader == user.username)
)
authorized = user.is_admin

# IncomingTransfers
try:
authorized = (
authorized
or (transfer.source == user.username)
or (transfer.uploader == user.username)
)
except AttributeError:
pass

# OutgoingTransfers
try:
Expand Down Expand Up @@ -125,11 +131,17 @@ def get_status_by_id(
for transfer_id in transfer_ids:
transfer = session.get(transfer_type, transfer_id, with_for_update=True)

authorized = (
user.is_admin
or (transfer.source == user.username)
or (transfer.uploader == user.username)
)
authorized = user.is_admin

# IncomingTransfers
try:
authorized = (
authorized
or (transfer.source == user.username)
or (transfer.uploader == user.username)
)
except AttributeError:
pass

# OutgoingTransfers
try:
Expand Down

0 comments on commit 68f26e7

Please sign in to comment.