Make cancellation policy read endpoint public
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
@@ -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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user