fix default assignment checker teams loading
This commit is contained in:
@@ -30,14 +30,11 @@
|
||||
namespace Espo\Core\Acl;
|
||||
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
|
||||
use Espo\Repositories\User as UserRepository;
|
||||
|
||||
use Espo\ORM\Defs;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\Entities\User;
|
||||
|
||||
use Espo\Core\AclManager;
|
||||
|
||||
/**
|
||||
@@ -48,7 +45,6 @@ class DefaultAssignmentChecker implements AssignmentChecker
|
||||
protected const FIELD_ASSIGNED_USERS = 'assignedUsers';
|
||||
protected const FIELD_TEAMS = 'teams';
|
||||
protected const ATTR_ASSIGNED_USER_ID = 'assignedUserId';
|
||||
protected const ATTR_TEAMS_IDS = 'teamsIds';
|
||||
protected const ATTR_ASSIGNED_USERS_IDS = 'assignedUsersIds';
|
||||
|
||||
public function __construct(
|
||||
@@ -141,7 +137,7 @@ class DefaultAssignmentChecker implements AssignmentChecker
|
||||
}
|
||||
}
|
||||
else if ($assignmentPermission === Table::LEVEL_TEAM) {
|
||||
$teamIdList = $user->get(self::ATTR_TEAMS_IDS);
|
||||
$teamIdList = $user->getTeamIdList();
|
||||
|
||||
if (
|
||||
!$this->getUserRepository()->checkBelongsToAnyOfTeams($assignedUserId, $teamIdList)
|
||||
@@ -210,7 +206,6 @@ class DefaultAssignmentChecker implements AssignmentChecker
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @var string[] $userTeamIdList */
|
||||
$userTeamIdList = $user->getLinkMultipleIdList(self::FIELD_TEAMS);
|
||||
|
||||
foreach ($newIdList as $id) {
|
||||
@@ -276,7 +271,8 @@ class DefaultAssignmentChecker implements AssignmentChecker
|
||||
$toProcess = false;
|
||||
|
||||
if (!$entity->isNew()) {
|
||||
$userIdList = $entity->getLinkMultipleIdList(self::FIELD_ASSIGNED_USERS);
|
||||
// Might be on purpose.
|
||||
$entity->getLinkMultipleIdList(self::FIELD_ASSIGNED_USERS);
|
||||
|
||||
if ($entity->isAttributeChanged(self::ATTR_ASSIGNED_USERS_IDS)) {
|
||||
$toProcess = true;
|
||||
@@ -313,7 +309,6 @@ class DefaultAssignmentChecker implements AssignmentChecker
|
||||
|
||||
private function isPermittedAssignedUsersLevelNo(User $user, CoreEntity $entity): bool
|
||||
{
|
||||
/** @var string[] $userIdList */
|
||||
$userIdList = $entity->getLinkMultipleIdList(self::FIELD_ASSIGNED_USERS);
|
||||
|
||||
$fetchedAssignedUserIdList = $entity->getFetched(self::ATTR_ASSIGNED_USERS_IDS);
|
||||
@@ -333,12 +328,10 @@ class DefaultAssignmentChecker implements AssignmentChecker
|
||||
|
||||
private function isPermittedAssignedUsersLevelTeam(User $user, CoreEntity $entity): bool
|
||||
{
|
||||
/** @var string[] $userIdList */
|
||||
$userIdList = $entity->getLinkMultipleIdList(self::FIELD_ASSIGNED_USERS);
|
||||
|
||||
$fetchedAssignedUserIdList = $entity->getFetched(self::ATTR_ASSIGNED_USERS_IDS);
|
||||
|
||||
/** @var string[] $teamIdList */
|
||||
$teamIdList = $user->getLinkMultipleIdList(self::FIELD_TEAMS);
|
||||
|
||||
foreach ($userIdList as $userId) {
|
||||
|
||||
Reference in New Issue
Block a user