Allow super admin to manage property roles
All checks were successful
build-and-deploy / build-deploy (push) Successful in 26s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 26s
This commit is contained in:
@@ -117,8 +117,10 @@ class Properties(
|
|||||||
requirePrincipal(principal)
|
requirePrincipal(principal)
|
||||||
propertyAccess.requireMember(propertyId, principal!!.userId)
|
propertyAccess.requireMember(propertyId, principal!!.userId)
|
||||||
|
|
||||||
|
val actorUser = appUserRepo.findById(principal.userId).orElse(null)
|
||||||
val actorRoles = propertyUserRepo.findRolesByPropertyAndUser(propertyId, principal.userId)
|
val actorRoles = propertyUserRepo.findRolesByPropertyAndUser(propertyId, principal.userId)
|
||||||
val allowedRoles = when {
|
val allowedRoles = when {
|
||||||
|
actorUser?.superAdmin == true -> setOf(Role.ADMIN, Role.MANAGER, Role.STAFF, Role.AGENT)
|
||||||
actorRoles.contains(Role.ADMIN) -> setOf(Role.ADMIN, Role.MANAGER, Role.STAFF, Role.AGENT)
|
actorRoles.contains(Role.ADMIN) -> setOf(Role.ADMIN, Role.MANAGER, Role.STAFF, Role.AGENT)
|
||||||
actorRoles.contains(Role.MANAGER) -> setOf(Role.STAFF, Role.AGENT)
|
actorRoles.contains(Role.MANAGER) -> setOf(Role.STAFF, Role.AGENT)
|
||||||
else -> emptySet()
|
else -> emptySet()
|
||||||
|
|||||||
Reference in New Issue
Block a user