. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ namespace Espo\Core\Utils; /** * A system user utility. */ class SystemUser { /** * A system user username. */ public const NAME = 'system'; private const ID = 'system'; private const UUID = 'ffffffff-ffff-ffff-ffff-ffffffffffff'; private string $id; public function __construct(Metadata $metadata, Config $config) { $id = $config->get('systemUserId'); if ($id) { $this->id = $id; return; } $isUuid = $metadata->get(['app', 'recordId', 'dbType']) === 'uuid'; $this->id = $isUuid ? self::UUID : self::ID; } /** * Get a system user ID. */ public function getId(): string { return $this->id; } }