Log action
This commit is contained in:
parent
0bcab27a1d
commit
3ca5eea877
|
|
@ -132,14 +132,22 @@ class UserController extends AbstractController
|
|||
$user->setModifiedAt(new \DateTimeImmutable('now'));
|
||||
$this->entityManager->persist($user);
|
||||
$this->entityManager->flush();
|
||||
$this->actionService->createAction("Edit user information", $actingUser, null, $user->getUserIdentifier());
|
||||
if ($request->get('organizationId')) {
|
||||
$org = $this->entityManager->getRepository(Organizations::class)->find($request->get('organizationId'));
|
||||
if ($org) {
|
||||
$this->actionService->createAction("Edit user information", $actingUser, $org, $user->getUserIdentifier());
|
||||
}
|
||||
} else {
|
||||
$this->actionService->createAction("Edit user information", $actingUser, null, $user->getUserIdentifier());
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('user_show', ['id' => $user->getId()]);
|
||||
return $this->redirectToRoute('user_show', ['id' => $user->getId(), 'organizationId' => $request->get('organizationId')]);
|
||||
}
|
||||
|
||||
return $this->render('user/edit.html.twig', [
|
||||
'user' => $user,
|
||||
'form' => $form->createView(),
|
||||
'organizationId' => $request->get('organizationId')
|
||||
]);
|
||||
}
|
||||
throw $this->createAccessDeniedException(self::ACCESS_DENIED);
|
||||
|
|
@ -158,12 +166,12 @@ class UserController extends AbstractController
|
|||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
|
||||
// Handle file upload
|
||||
// Handle file upload
|
||||
$picture = $form->get('pictureUrl')->getData();
|
||||
|
||||
if ($picture) {
|
||||
$this->userService->handleProfilePicture($user, $picture);
|
||||
}else{
|
||||
} else {
|
||||
$user->setPictureUrl("");
|
||||
}
|
||||
//FOR TEST PURPOSES, SETTING A DEFAULT RANDOM PASSWORD
|
||||
|
|
@ -175,7 +183,7 @@ class UserController extends AbstractController
|
|||
$uo->setUsers($user);
|
||||
$uo->setOrganization($org);
|
||||
$this->entityManager->persist($uo);
|
||||
$this->actionService->createAction("Create new user", $user, $org, "Added user to organization". $user->getUserIdentifier()." for organization ".$org->getName());
|
||||
$this->actionService->createAction("Create new user", $user, $org, "Added user to organization" . $user->getUserIdentifier() . " for organization " . $org->getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -266,7 +274,7 @@ class UserController extends AbstractController
|
|||
$this->userOrganizationAppService->deactivateAllUserOrganizationsAppLinks($uo);
|
||||
$this->entityManager->persist($uo);
|
||||
$this->entityManager->flush();
|
||||
$this->actionService->createAction("Deactivate user in organization", $actingUser, $org, $org->getName()." for user ".$user->getUserIdentifier());
|
||||
$this->actionService->createAction("Deactivate user in organization", $actingUser, $org, $org->getName() . " for user " . $user->getUserIdentifier());
|
||||
|
||||
return $this->redirectToRoute('user_index');
|
||||
}
|
||||
|
|
@ -298,7 +306,7 @@ class UserController extends AbstractController
|
|||
$uo->setIsActive(true);
|
||||
$this->entityManager->persist($uo);
|
||||
$this->entityManager->flush();
|
||||
$this->actionService->createAction("Activate user in organization", $actingUser, $org, $org->getName()." for user ".$user->getUserIdentifier());
|
||||
$this->actionService->createAction("Activate user in organization", $actingUser, $org, $org->getName() . " for user " . $user->getUserIdentifier());
|
||||
|
||||
return $this->redirectToRoute('user_index');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
{{ form_start(form, {'action': path('user_edit', {'id': user.id}), 'method': 'PUT'}) }}
|
||||
{{ form_widget(form) }}
|
||||
<input hidden type="text" value="{{ organizationId }}" name="organizationId">
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<a href="{{ path('user_edit', {'id': user.id}) }}" class="btn btn-primary">Modifier</a>
|
||||
<a href="{{ path('user_edit', {'id': user.id, 'organizationId': organizationId}) }}" class="btn btn-primary">Modifier</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
|
|
|||
Loading…
Reference in New Issue