Log action
This commit is contained in:
parent
328a89f11f
commit
0d498d4570
|
|
@ -137,12 +137,12 @@ class UserController extends AbstractController
|
||||||
//log the action
|
//log the action
|
||||||
$user = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
$user = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $user->getUserIdentifier()]);
|
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $user->getUserIdentifier()]);
|
||||||
$this->actionService->createAction("Création d'une organisation", $user, $organization, "{$user->getIdentifier()} à ajouter l'utilisateur {$data->getUserIdentifier()} à l'organisation {$organization->getName()}");
|
$this->actionService->createAction("Création d'un utilisateur", $user, $organization, "{$user->getIdentifier()} à ajouter l'utilisateur {$data->getUserIdentifier()} à l'organisation {$organization->getName()}");
|
||||||
$this->entityManager->persist($uo);
|
$this->entityManager->persist($uo);
|
||||||
} else {
|
} else {
|
||||||
$user = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
$user = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $user->getUserIdentifier()]);
|
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $user->getUserIdentifier()]);
|
||||||
$this->actionService->createAction("Création d'une organisation", $user, null, "{$user->getIdentifier()} à ajouter l'utilisateur {$data->getUserIdentifier()} sans organisation");
|
$this->actionService->createAction("Création d'un utilisateur", $user, null, "{$user->getIdentifier()} à ajouter l'utilisateur {$data->getUserIdentifier()} sans organisation");
|
||||||
}
|
}
|
||||||
$this->entityManager->persist($data);
|
$this->entityManager->persist($data);
|
||||||
|
|
||||||
|
|
@ -251,9 +251,9 @@ class UserController extends AbstractController
|
||||||
$user->setIsDeleted(true);
|
$user->setIsDeleted(true);
|
||||||
$entityManager->persist($user);
|
$entityManager->persist($user);
|
||||||
// Log the action
|
// Log the action
|
||||||
$user = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
$actingUser = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $user->getUserIdentifier()]);
|
$actingUser = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $actingUser->getUserIdentifier()]);
|
||||||
$this->actionService->createAction("Création d'une organisation", $user, null, "{$user->getIdentifier()} a supprimé l'utilisateur {$user->getUserIdentifier()}");
|
$this->actionService->createAction("Supression d'un utilisateur", $actingUser, null, "{$actingUser->getIdentifier()} a supprimé l'utilisateur {$user->getUserIdentifier()}");
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
return $this->redirectToRoute('user_index');
|
return $this->redirectToRoute('user_index');
|
||||||
|
|
@ -277,10 +277,10 @@ class UserController extends AbstractController
|
||||||
// Handle user deletion logic
|
// Handle user deletion logic
|
||||||
$entityManager->remove($user);
|
$entityManager->remove($user);
|
||||||
// Log the action
|
// Log the action
|
||||||
$action = new Actions();
|
|
||||||
$action->setActionType('Suppression définitive utilisateur');
|
$actingUser = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
$action->setUsers($this->getUser());
|
$actingUser = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $actingUser->getUserIdentifier()]);
|
||||||
$entityManager->persist($action);
|
$this->actionService->createAction("Suppression définitive d'un utilisateur", $actingUser, null, "{$actingUser->getIdentifier()} a supprimé l'utilisateur {$user->getUserIdentifier()}");
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
|
|
||||||
return $this->redirectToRoute('user_index');
|
return $this->redirectToRoute('user_index');
|
||||||
|
|
@ -304,9 +304,9 @@ class UserController extends AbstractController
|
||||||
$user->setIsActive(false);
|
$user->setIsActive(false);
|
||||||
$entityManager->persist($user);
|
$entityManager->persist($user);
|
||||||
// Log the action
|
// Log the action
|
||||||
$user = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
$actingUser = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
$user = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $user->getUserIdentifier()]);
|
$actingUser = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $actingUser->getUserIdentifier()]);
|
||||||
$this->actionService->createAction("Création d'une organisation", $user, null, "{$user->getIdentifier()} a désactivé l'utilisateur {$user->getUserIdentifier()}");
|
$this->actionService->createAction("Désactivation d'un utilisateur", $actingUser, null, "{$actingUser->getIdentifier()} a désactivé l'utilisateur {$user->getUserIdentifier()}");
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
return $this->redirectToRoute('user_index');
|
return $this->redirectToRoute('user_index');
|
||||||
}
|
}
|
||||||
|
|
@ -406,6 +406,9 @@ class UserController extends AbstractController
|
||||||
$organization = $userOrganization->getOrganization() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
$organization = $userOrganization->getOrganization() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
|
|
||||||
$this->userOrganizationService->deactivateAllUserRoles($user, $organization);
|
$this->userOrganizationService->deactivateAllUserRoles($user, $organization);
|
||||||
|
$actingUser = $this->getUser() ?? throw $this->createNotFoundException(self::NOT_FOUND);
|
||||||
|
$actingUser = $this->entityManager->getRepository(User::class)->findOneBy(['email' => $actingUser->getUserIdentifier()]);
|
||||||
|
$this->actionService->createAction("Désactivation d'un utilisateur dans une organisation", $actingUser, $organization, "{$actingUser->getIdentifier()} a désactivé l'utilisateur {$user->getUserIdentifier()} dans l'organisation {$organization->getName()}");
|
||||||
|
|
||||||
return $this->redirectToRoute('user_show', ['id' => $user->getId()]);
|
return $this->redirectToRoute('user_show', ['id' => $user->getId()]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue