Allow super admin to manage property roles
All checks were successful
build-and-deploy / build-deploy (push) Successful in 26s

This commit is contained in:
androidlover5842
2026-01-26 23:53:21 +05:30
parent 1400451bfe
commit 22a9fdc851

View File

@@ -117,8 +117,10 @@ class Properties(
requirePrincipal(principal)
propertyAccess.requireMember(propertyId, principal!!.userId)
val actorUser = appUserRepo.findById(principal.userId).orElse(null)
val actorRoles = propertyUserRepo.findRolesByPropertyAndUser(propertyId, principal.userId)
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.MANAGER) -> setOf(Role.STAFF, Role.AGENT)
else -> emptySet()