Make cancellation policy read endpoint public
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s

This commit is contained in:
androidlover5842
2026-02-02 09:34:58 +05:30
parent 4c20cbd7ca
commit 734591807f
2 changed files with 2 additions and 1 deletions

View File

@@ -35,7 +35,6 @@ class CancellationPolicies(
@PathVariable propertyId: UUID, @PathVariable propertyId: UUID,
@AuthenticationPrincipal principal: MyPrincipal? @AuthenticationPrincipal principal: MyPrincipal?
): CancellationPolicyResponse { ): CancellationPolicyResponse {
requireRole(propertyAccess, propertyId, principal, Role.ADMIN, Role.MANAGER, Role.FINANCE)
val policy = policyRepo.findByPropertyId(propertyId) val policy = policyRepo.findByPropertyId(propertyId)
return if (policy != null) { return if (policy != null) {
CancellationPolicyResponse( CancellationPolicyResponse(

View File

@@ -13,6 +13,7 @@ internal object PublicEndpoints {
private val razorpayWebhook = Regex("^/properties/[^/]+/razorpay/webhook$") private val razorpayWebhook = Regex("^/properties/[^/]+/razorpay/webhook$")
private val razorpayReturn = Regex("^/properties/[^/]+/razorpay/return/(success|failure)$") private val razorpayReturn = Regex("^/properties/[^/]+/razorpay/return/(success|failure)$")
private val guestDocumentFile = Regex("^/properties/[^/]+/guests/[^/]+/documents/[^/]+/file$") private val guestDocumentFile = Regex("^/properties/[^/]+/guests/[^/]+/documents/[^/]+/file$")
private val cancellationPolicy = Regex("^/properties/[^/]+/cancellation-policy$")
fun isPublic(request: HttpServletRequest): Boolean { fun isPublic(request: HttpServletRequest): Boolean {
val path = request.requestURI val path = request.requestURI
@@ -32,5 +33,6 @@ internal object PublicEndpoints {
|| path == "/icons/png" || path == "/icons/png"
|| iconPngFile.matches(path) || iconPngFile.matches(path)
|| guestDocumentFile.matches(path) || guestDocumentFile.matches(path)
|| (cancellationPolicy.matches(path) && method == "GET")
} }
} }