Log action
This commit is contained in:
parent
0bcab27a1d
commit
3ca5eea877
|
|
@ -132,14 +132,22 @@ class UserController extends AbstractController
|
||||||
$user->setModifiedAt(new \DateTimeImmutable('now'));
|
$user->setModifiedAt(new \DateTimeImmutable('now'));
|
||||||
$this->entityManager->persist($user);
|
$this->entityManager->persist($user);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
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());
|
$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', [
|
return $this->render('user/edit.html.twig', [
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
|
'organizationId' => $request->get('organizationId')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
throw $this->createAccessDeniedException(self::ACCESS_DENIED);
|
throw $this->createAccessDeniedException(self::ACCESS_DENIED);
|
||||||
|
|
@ -163,7 +171,7 @@ class UserController extends AbstractController
|
||||||
|
|
||||||
if ($picture) {
|
if ($picture) {
|
||||||
$this->userService->handleProfilePicture($user, $picture);
|
$this->userService->handleProfilePicture($user, $picture);
|
||||||
}else{
|
} else {
|
||||||
$user->setPictureUrl("");
|
$user->setPictureUrl("");
|
||||||
}
|
}
|
||||||
//FOR TEST PURPOSES, SETTING A DEFAULT RANDOM PASSWORD
|
//FOR TEST PURPOSES, SETTING A DEFAULT RANDOM PASSWORD
|
||||||
|
|
@ -175,7 +183,7 @@ class UserController extends AbstractController
|
||||||
$uo->setUsers($user);
|
$uo->setUsers($user);
|
||||||
$uo->setOrganization($org);
|
$uo->setOrganization($org);
|
||||||
$this->entityManager->persist($uo);
|
$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->userOrganizationAppService->deactivateAllUserOrganizationsAppLinks($uo);
|
||||||
$this->entityManager->persist($uo);
|
$this->entityManager->persist($uo);
|
||||||
$this->entityManager->flush();
|
$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');
|
return $this->redirectToRoute('user_index');
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +306,7 @@ class UserController extends AbstractController
|
||||||
$uo->setIsActive(true);
|
$uo->setIsActive(true);
|
||||||
$this->entityManager->persist($uo);
|
$this->entityManager->persist($uo);
|
||||||
$this->entityManager->flush();
|
$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');
|
return $this->redirectToRoute('user_index');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
{{ form_start(form, {'action': path('user_edit', {'id': user.id}), 'method': 'PUT'}) }}
|
{{ form_start(form, {'action': path('user_edit', {'id': user.id}), 'method': 'PUT'}) }}
|
||||||
{{ form_widget(form) }}
|
{{ form_widget(form) }}
|
||||||
|
<input hidden type="text" value="{{ organizationId }}" name="organizationId">
|
||||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% 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>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue