This commit is contained in:
Yuri Kuznetsov
2022-10-18 21:32:21 +03:00
parent 1f88b60cca
commit 531992adff
4 changed files with 131 additions and 80 deletions

View File

@@ -33,12 +33,10 @@ use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\NotFound;
use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Exceptions\BadRequest;
use Espo\Services\User as Service;
use Espo\Core\Api\Request;
use Espo\Core\Controllers\Record;
use Espo\Core\Mail\Exceptions\SendingError;
use Espo\Tools\UserSecurity\ApiService;
use Espo\Tools\UserSecurity\Password\RecoveryService;
use Espo\Core\Select\SearchParams;
use Espo\Core\Select\Where\Item as WhereItem;
@@ -163,12 +161,12 @@ class User extends Record
throw new Forbidden();
}
return $this->getUserService()
->generateNewApiKeyForEntity($data->id)
return $this->injectableFactory
->create(ApiService::class)
->generateNewApiKey($data->id)
->getValueMap();
}
/**
* @throws BadRequest
* @throws Forbidden
@@ -257,10 +255,4 @@ class User extends Record
{
return $this->injectableFactory->create(PasswordService::class);
}
private function getUserService(): Service
{
/** @var Service */
return $this->getServiceFactory()->create('User');
}
}