Hide requesting user from user lists
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s

This commit is contained in:
androidlover5842
2026-02-01 22:15:25 +05:30
parent c4b83d2122
commit f9929064fb
2 changed files with 4 additions and 4 deletions

View File

@@ -102,7 +102,7 @@ class Properties(
propertyAccess.requireMember(propertyId, principal!!.userId) propertyAccess.requireMember(propertyId, principal!!.userId)
propertyAccess.requireAnyRole(propertyId, principal.userId, Role.ADMIN, Role.MANAGER) propertyAccess.requireAnyRole(propertyId, principal.userId, Role.ADMIN, Role.MANAGER)
val users = propertyUserRepo.findByIdPropertyId(propertyId) val users = propertyUserRepo.findByIdPropertyId(propertyId)
return users.map { return users.filter { it.id.userId != principal.userId }.map {
PropertyUserResponse( PropertyUserResponse(
userId = it.id.userId!!, userId = it.id.userId!!,
propertyId = it.id.propertyId!!, propertyId = it.id.propertyId!!,

View File

@@ -28,14 +28,14 @@ class UserDirectory(
@AuthenticationPrincipal principal: MyPrincipal?, @AuthenticationPrincipal principal: MyPrincipal?,
@RequestParam(required = false) phone: String? @RequestParam(required = false) phone: String?
): List<AppUserSummaryResponse> { ): List<AppUserSummaryResponse> {
requireSuperAdmin(appUserRepo, principal) val actor = requireSuperAdmin(appUserRepo, principal)
val digits = phone?.filter { it.isDigit() }.orEmpty() val digits = phone?.filter { it.isDigit() }.orEmpty()
val users = when { val users = when {
phone == null -> appUserRepo.findAll() phone == null -> appUserRepo.findAll()
digits.length < 6 -> return emptyList() digits.length < 6 -> return emptyList()
else -> appUserRepo.findByPhoneE164Containing(digits) else -> appUserRepo.findByPhoneE164Containing(digits)
} }
return users.map { return users.filter { it.id != actor.id }.map {
AppUserSummaryResponse( AppUserSummaryResponse(
id = it.id!!, id = it.id!!,
phoneE164 = it.phoneE164, phoneE164 = it.phoneE164,
@@ -62,7 +62,7 @@ class UserDirectory(
digits.length < 6 -> return emptyList() digits.length < 6 -> return emptyList()
else -> propertyUserRepo.findByPropertyIdAndPhoneLike(propertyId, digits) else -> propertyUserRepo.findByPropertyIdAndPhoneLike(propertyId, digits)
} }
return users.map { return users.filter { it.id.userId != resolved.userId }.map {
val user = it.user val user = it.user
PropertyUserDetailsResponse( PropertyUserDetailsResponse(
userId = it.id.userId!!, userId = it.id.userId!!,