mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-07 08:56:59 +01:00
* [FIX] Client custom fields were not created/saved. Thanks to @ZUNbado and @sf32738 for the notice. Closes #1375
* [MOD] Minor code tweaks Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -28,13 +28,12 @@ namespace SP\Modules\Web\Controllers;
|
||||
use DI\DependencyException;
|
||||
use DI\NotFoundException;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use SP\Core\Acl\Acl;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Core\Exceptions\ConstraintException;
|
||||
use SP\Core\Exceptions\QueryException;
|
||||
use SP\Core\Exceptions\SessionTimeout;
|
||||
use SP\Core\Exceptions\SPException;
|
||||
use SP\Core\Exceptions\ValidationException;
|
||||
use SP\DataModel\ClientData;
|
||||
@@ -267,7 +266,7 @@ final class ClientController extends ControllerBase implements CrudControllerInt
|
||||
|
||||
$itemData = $form->getItemData();
|
||||
|
||||
$this->clientService->create($itemData);
|
||||
$id = $this->clientService->create($itemData);
|
||||
|
||||
$this->eventDispatcher->notifyEvent('create.client',
|
||||
new Event($this,
|
||||
@@ -276,6 +275,8 @@ final class ClientController extends ControllerBase implements CrudControllerInt
|
||||
->addDetail(__u('Client'), $itemData->getName()))
|
||||
);
|
||||
|
||||
$this->addCustomFieldsForItem(Acl::CLIENT, $id, $this->request);
|
||||
|
||||
return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Client added'));
|
||||
} catch (ValidationException $e) {
|
||||
return $this->returnJsonResponseException($e);
|
||||
@@ -316,6 +317,8 @@ final class ClientController extends ControllerBase implements CrudControllerInt
|
||||
->addDetail(__u('Client'), $id))
|
||||
);
|
||||
|
||||
$this->updateCustomFieldsForItem(Acl::CLIENT, $id, $this->request);
|
||||
|
||||
return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Client updated'));
|
||||
} catch (ValidationException $e) {
|
||||
return $this->returnJsonResponseException($e);
|
||||
@@ -364,9 +367,10 @@ final class ClientController extends ControllerBase implements CrudControllerInt
|
||||
/**
|
||||
* Initialize class
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws AuthException
|
||||
* @throws DependencyException
|
||||
* @throws NotFoundException
|
||||
* @throws SessionTimeout
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user