Skip to content

EspoCRM – Open Source CRM Application

ref

Yuri Kuznetsov9ee52dc469b9
diff --git a/application/Espo/Classes/Acl/User/AccessChecker.php b/application/Espo/Classes/Acl/User/AccessChecker.php
index 8cdbcddb78..7e571c72a9 100644
--- a/application/Espo/Classes/Acl/User/AccessChecker.php
+++ b/application/Espo/Classes/Acl/User/AccessChecker.php
@@ -70,18 +70,18 @@ class AccessChecker implements AccessEntityCREDSChecker
return false;
}
- if ($entity->isPortal()) {
- if ($this->aclManager->getPermissionLevel($user, Permission::PORTAL) === Table::LEVEL_YES) {
- return true;
- }
-
+ if ($entity->isSuperAdmin() && !$user->isSuperAdmin()) {
return false;
}
- if ($entity->isSuperAdmin() && !$user->isSuperAdmin()) {
+ if ($entity->isSystem()) {
return false;
}
+ if ($entity->isPortal()) {
+ return $this->aclManager->getPermissionLevel($user, Permission::PORTAL) === Table::LEVEL_YES;
+ }
+
return $this->defaultAccessChecker->checkEntityRead($user, $entity, $data);
}
diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php
index 1b93a645ac..ff73323398 100644
--- a/application/Espo/Services/User.php
+++ b/application/Espo/Services/User.php
@@ -54,29 +54,6 @@ class User extends Record implements LogAware
{
use LogSetter;
- /**
- * @throws Forbidden
- */
- public function getEntity(string $id): ?Entity
- {
- /** @var ?UserEntity $entity */
- $entity = parent::getEntity($id);
-
- if (!$entity) {
- return null;
- }
-
- if ($entity->isSuperAdmin() && !$this->user->isSuperAdmin()) {
- throw new Forbidden();
- }
-
- if ($entity->isSystem()) {
- throw new Forbidden();
- }
-
- return $entity;
- }
-
private function hashPassword(#[SensitiveParameter] string $password): string
{
$passwordHash = $this->injectableFactory->create(PasswordHash::class);