Restrict booking actions to admin/manager
Some checks failed
build-and-deploy / build-deploy (push) Failing after 28s
Some checks failed
build-and-deploy / build-deploy (push) Failing after 28s
This commit is contained in:
@@ -435,7 +435,7 @@ class BookingFlow(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun requireActor(propertyId: UUID, principal: MyPrincipal?): com.android.trisolarisserver.models.property.AppUser {
|
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 {
|
return appUserRepo.findById(resolved.userId).orElseThrow {
|
||||||
ResponseStatusException(HttpStatus.UNAUTHORIZED, "User not found")
|
ResponseStatusException(HttpStatus.UNAUTHORIZED, "User not found")
|
||||||
}
|
}
|
||||||
@@ -462,9 +462,7 @@ class BookingFlow(
|
|||||||
property: com.android.trisolarisserver.models.property.Property,
|
property: com.android.trisolarisserver.models.property.Property,
|
||||||
mode: TransportMode
|
mode: TransportMode
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val allowed = if (property.allowedTransportModes.isNotEmpty()) {
|
val allowed = property.allowedTransportModes.ifEmpty {
|
||||||
property.allowedTransportModes
|
|
||||||
} else {
|
|
||||||
TransportMode.entries.toSet()
|
TransportMode.entries.toSet()
|
||||||
}
|
}
|
||||||
return allowed.contains(mode)
|
return allowed.contains(mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user