Restrict booking actions to admin/manager
Some checks failed
build-and-deploy / build-deploy (push) Failing after 28s

This commit is contained in:
androidlover5842
2026-01-29 09:55:52 +05:30
parent 52f9b94031
commit d033686e53

View File

@@ -435,7 +435,7 @@ class BookingFlow(
}
private fun requireActor(propertyId: UUID, principal: MyPrincipal?): com.android.trisolarisserver.models.property.AppUser {
val resolved = requireRole(propertyAccess, propertyId, principal, Role.ADMIN, Role.MANAGER, Role.STAFF)
val resolved = requireRole(propertyAccess, propertyId, principal, Role.ADMIN, Role.MANAGER)
return appUserRepo.findById(resolved.userId).orElseThrow {
ResponseStatusException(HttpStatus.UNAUTHORIZED, "User not found")
}
@@ -462,9 +462,7 @@ class BookingFlow(
property: com.android.trisolarisserver.models.property.Property,
mode: TransportMode
): Boolean {
val allowed = if (property.allowedTransportModes.isNotEmpty()) {
property.allowedTransportModes
} else {
val allowed = property.allowedTransportModes.ifEmpty {
TransportMode.entries.toSet()
}
return allowed.contains(mode)