fix stream portal user

This commit is contained in:
yuri
2019-10-03 13:41:53 +03:00
parent 850f6ad41e
commit 415eff0486
+15 -2
View File
@@ -1662,17 +1662,30 @@ class Stream extends \Espo\Core\Services\Base
{
$ignoreScopeList = [];
$scopes = $this->getMetadata()->get('scopes', []);
$aclManager = $this->getAclManager();
if ($user->isPortal() && !$this->getUser()->isPortal()) {
$aclManager = new \Espo\Core\Portal\AclManager($this->getInjection('container'));
$portals = $user->get('portals');
if (count($portals)) {
$aclManager->setPortal($portals[0]);
}
}
foreach ($scopes as $scope => $item) {
if (empty($item['entity'])) continue;
if (empty($item['object'])) continue;
if (
!$this->getAclManager()->checkScope($user, $scope, 'read')
!$aclManager->checkScope($user, $scope, 'read')
||
!$this->getAclManager()->checkScope($user, $scope, 'stream')
!$aclManager->checkScope($user, $scope, 'stream')
) {
$ignoreScopeList[] = $scope;
}
}
return $ignoreScopeList;
}