Skip to content

Commit

Permalink
Changed required permissions for checkins
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Aug 12, 2024
1 parent 83760fa commit 6dff620
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions librarian_server/api/checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from ..database import yield_session
from ..logger import log, log_to_database
from .auth import ReadappendUserDependency, User
from .auth import CallbackUserDependency, ReadappendUserDependency, User

router = APIRouter(prefix="/api/v2/checkin")

Expand Down Expand Up @@ -131,6 +131,12 @@ def get_status_by_id(
or (transfer.uploader == user.username)
)

# OutgoingTransfers
try:
authorized = authorized or (transfer.destination == user.username)
except AttributeError:
pass

status[transfer_id] = (
transfer.status if transfer is not None and authorized else None
)
Expand All @@ -142,7 +148,7 @@ def get_status_by_id(
def update(
request: CheckinUpdateRequest,
response: Response,
user: ReadappendUserDependency,
user: CallbackUserDependency,
session: Session = Depends(yield_session),
):
"""
Expand Down Expand Up @@ -187,7 +193,7 @@ def update(
def status(
request: CheckinStatusRequest,
response: Response,
user: ReadappendUserDependency,
user: CallbackUserDependency,
session: Session = Depends(yield_session),
):
"""
Expand Down

0 comments on commit 6dff620

Please sign in to comment.