Skip to content

Commit

Permalink
config: Update checkout permissions to support self checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 authored and kpsherva committed Jun 10, 2024
1 parent 2a52095 commit 3c1f210
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
13 changes: 12 additions & 1 deletion cds_ils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@
circulation_default_extension_duration,
circulation_default_loan_duration,
)
from invenio_app_ils.items.api import ITEM_PID_TYPE
from invenio_app_ils.literature.api import LITERATURE_PID_TYPE
from invenio_app_ils.locations.api import LOCATION_PID_TYPE
from invenio_app_ils.patrons.api import PATRON_PID_TYPE
from invenio_app_ils.permissions import (
authenticated_user_permission,
backoffice_permission,
loan_checkout_permission,
loan_extend_circulation_permission,
patron_owner_permission,
)
Expand Down Expand Up @@ -401,9 +403,15 @@ def _parse_env_bool(var_name, default=None):
"application/json": "cds_ils.series.serializers:json_v1_search",
"text/csv": "cds_ils.series.serializers:csv_v1_search",
}
RECORDS_REST_ENDPOINTS[ITEM_PID_TYPE][
"list_permission_factory_imp"
] = authenticated_user_permission
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"
] = loan_checkout_permission

###############################################################################
# ILS overridden
Expand Down Expand Up @@ -575,7 +583,7 @@ def _parse_env_bool(var_name, default=None):
dest="ITEM_ON_LOAN",
trigger="checkout",
transition=ILSToItemOnLoan,
permission_factory=backoffice_permission,
permission_factory=loan_checkout_permission,
),
],
"PENDING": [
Expand Down Expand Up @@ -725,3 +733,6 @@ def _parse_env_bool(var_name, default=None):
ILS_ILL_NOTIFICATIONS_FILTER = ill_notifications_filter
ILS_NOTIFICATIONS_FILTER_DOCUMENT_REQUEST = document_requests_notifications_filter
SECURITY_PASSWORD_SINGLE_HASH = True

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

from invenio_access import action_factory
from invenio_access.permissions import Permission
from invenio_app_ils.permissions import backoffice_access_action, backoffice_permission
from invenio_app_ils.permissions import (
authenticated_user_permission,
backoffice_access_action,
)
from invenio_app_ils.permissions import (
views_permissions_factory as ils_views_permissions_factory,
)
Expand All @@ -35,4 +38,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)
1 change: 1 addition & 0 deletions ui/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const config = {
{ name: "privacy-policy", route: "/privacy-policy", apiURL: "6" },
],
ENABLE_LOCAL_ACCOUNT_LOGIN: false,
ENABLE_SELF_CHECKOUT: true,
OAUTH_PROVIDERS: {
github: {
enabled: false,
Expand Down

0 comments on commit 3c1f210

Please sign in to comment.