Hide requesting user from user lists
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 35s
This commit is contained in:
@@ -102,7 +102,7 @@ class Properties(
|
||||
propertyAccess.requireMember(propertyId, principal!!.userId)
|
||||
propertyAccess.requireAnyRole(propertyId, principal.userId, Role.ADMIN, Role.MANAGER)
|
||||
val users = propertyUserRepo.findByIdPropertyId(propertyId)
|
||||
return users.map {
|
||||
return users.filter { it.id.userId != principal.userId }.map {
|
||||
PropertyUserResponse(
|
||||
userId = it.id.userId!!,
|
||||
propertyId = it.id.propertyId!!,
|
||||
|
||||
@@ -28,14 +28,14 @@ class UserDirectory(
|
||||
@AuthenticationPrincipal principal: MyPrincipal?,
|
||||
@RequestParam(required = false) phone: String?
|
||||
): List<AppUserSummaryResponse> {
|
||||
requireSuperAdmin(appUserRepo, principal)
|
||||
val actor = requireSuperAdmin(appUserRepo, principal)
|
||||
val digits = phone?.filter { it.isDigit() }.orEmpty()
|
||||
val users = when {
|
||||
phone == null -> appUserRepo.findAll()
|
||||
digits.length < 6 -> return emptyList()
|
||||
else -> appUserRepo.findByPhoneE164Containing(digits)
|
||||
}
|
||||
return users.map {
|
||||
return users.filter { it.id != actor.id }.map {
|
||||
AppUserSummaryResponse(
|
||||
id = it.id!!,
|
||||
phoneE164 = it.phoneE164,
|
||||
@@ -62,7 +62,7 @@ class UserDirectory(
|
||||
digits.length < 6 -> return emptyList()
|
||||
else -> propertyUserRepo.findByPropertyIdAndPhoneLike(propertyId, digits)
|
||||
}
|
||||
return users.map {
|
||||
return users.filter { it.id.userId != resolved.userId }.map {
|
||||
val user = it.user
|
||||
PropertyUserDetailsResponse(
|
||||
userId = it.id.userId!!,
|
||||
|
||||
Reference in New Issue
Block a user