mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
exception changes
This commit is contained in:
@@ -29,10 +29,6 @@
|
||||
|
||||
namespace Espo\Core;
|
||||
|
||||
use Espo\Core\Exceptions\{
|
||||
Error,
|
||||
};
|
||||
|
||||
use Espo\Entities\{
|
||||
User,
|
||||
};
|
||||
@@ -41,6 +37,8 @@ use Espo\Core\{
|
||||
ORM\EntityManagerProxy,
|
||||
};
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Setting a current user for the application.
|
||||
*/
|
||||
@@ -57,15 +55,14 @@ class ApplicationUser
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the system user as a current user. The system user is used when no user is logged in.
|
||||
* @throws Error
|
||||
* Set up the system user as a current user. The system user is used when no user is logged in.
|
||||
*/
|
||||
public function setupSystemUser(): void
|
||||
{
|
||||
$user = $this->entityManagerProxy->getEntity('User', 'system');
|
||||
|
||||
if (!$user) {
|
||||
throw new Error("System user is not found.");
|
||||
throw new RuntimeException("System user is not found.");
|
||||
}
|
||||
|
||||
$user->set('ipAddress', $_SERVER['REMOTE_ADDR'] ?? null);
|
||||
|
||||
Reference in New Issue
Block a user