Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! Fixes #24219: Display user detail …
Browse files Browse the repository at this point in the history
…using information from database

Fixes #24219: Display user detail using information from database
  • Loading branch information
clarktsiory committed Feb 26, 2024
1 parent 310872a commit 6adbd75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ class UserManagementService(

/*
* When we delete an user, it can be from file or auto-added by OIDC or other backend supporting that.
* So we let the callback on file reload do the deletion from base.
* So we let the callback on file reload do the deletion for file users, and then delete from the user repository.
*/
def remove(toDelete: String, actor: EventActor): IOResult[Unit] = {
def remove(toDelete: String, actor: EventActor, reason: String): IOResult[Unit] = {
for {
file <- getUserResourceFile.map(getUserFilePath(_))
parsedFile <- IOResult.attempt(ConstructingParser.fromFile(file.toJava, preserveWS = true))
Expand All @@ -273,7 +273,7 @@ class UserManagementService(
}).transform(toUpdate).head
_ <- UserManagementIO.replaceXml(userXML, newXml, file)
_ <- userService.reloadPure()
_ <- userRepository.delete(List(toDelete), None, Nil, EventTrace(actor, DateTime.now()))
_ <- userRepository.delete(List(toDelete), None, Nil, EventTrace(actor, DateTime.now(), reason))
} yield ()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class UserManagementApiImpl(
): LiftResponse = {

(for {
_ <- userManagementService.remove(id, authzToken.actor)
_ <- userManagementService.remove(id, authzToken.actor, "User deleted by user management API")
} yield {
id.transformInto[JsonDeletedUser]
}).chainError(s"Could not delete user ${id}").toLiftResponseOne(params, schema, _ => None)
Expand Down

0 comments on commit 6adbd75

Please sign in to comment.