Skip to content

Commit

Permalink
config: Use loan_checkout_permission for self checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 committed Jun 6, 2024
1 parent f62d316 commit 1bd9c44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 4 additions & 10 deletions cds_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
backoffice_permission,
loan_extend_circulation_permission,
patron_owner_permission,
loan_checkout_permission,
)
from invenio_app_ils.series.api import SERIES_PID_TYPE
from invenio_app_ils.items.api import ITEM_PID_TYPE
Expand Down Expand Up @@ -406,17 +407,10 @@ def _parse_env_bool(var_name, default=None):
ILS_CIRCULATION_RECORDS_REST_ENDPOINTS[CIRCULATION_LOAN_PID_TYPE]["search_serializers"][
"text/csv"
] = "cds_ils.circulation.serializers:csv_v1_search"
ILS_CIRCULATION_RECORDS_REST_ENDPOINTS[CIRCULATION_LOAN_PID_TYPE]["update_permission_factory_imp"] = authenticated_user_permission
ILS_CIRCULATION_RECORDS_REST_ENDPOINTS[CIRCULATION_LOAN_PID_TYPE]["update_permission_factory_imp"] = loan_checkout_permission

###############################################################################
# ILS overridden
###############################################################################
ILS_AUTHENTICATED_USER_PERMISSIONS = [
"circulation-loan-request",
"patron-loans",
"bulk-loan-extension",
"circulation-loan-checkout",
]

ILS_VIEWS_PERMISSIONS_FACTORY = views_permissions_factory

Expand Down Expand Up @@ -585,7 +579,7 @@ def _parse_env_bool(var_name, default=None):
dest="ITEM_ON_LOAN",
trigger="checkout",
transition=ILSToItemOnLoan,
permission_factory=authenticated_user_permission,
permission_factory=loan_checkout_permission,
),
],
"PENDING": [
Expand Down Expand Up @@ -737,4 +731,4 @@ def _parse_env_bool(var_name, default=None):
SECURITY_PASSWORD_SINGLE_HASH = True

# Feature Toggles
SELF_CHECKOUT_ENABLED = True
ILS_SELF_CHECKOUT_ENABLED = True
4 changes: 3 additions & 1 deletion cds_ils/patrons/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from invenio_access import action_factory
from invenio_access.permissions import Permission
from invenio_app_ils.permissions import backoffice_access_action
from invenio_app_ils.permissions import backoffice_access_action, authenticated_user_permission
from invenio_app_ils.permissions import (
views_permissions_factory as ils_views_permissions_factory,
)
Expand All @@ -35,4 +35,6 @@ def views_permissions_factory(action):
return retrieve_patron_loans_permission()
elif action == "document-importer":
return document_importer_permission()
elif action == "circulation-loan-checkout":
return authenticated_user_permission()
return ils_views_permissions_factory(action)

0 comments on commit 1bd9c44

Please sign in to comment.