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 {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user