portal = $portal; parent::__construct($user, $config, $fileManager, $metadata, $fieldManager); } protected function getPortal() { return $this->portal; } protected function initCacheFilePath() { $this->cacheFilePath = 'data/cache/application/acl-portal/'.$this->getPortal()->id.'/' . $this->getUser()->id . '.php'; } protected function getRoleList() { $roleList = []; $userRoleList = $this->getUser()->get('portalRoles'); if (!(is_array($userRoleList) || $userRoleList instanceof \Traversable)) { throw new Error(); } foreach ($userRoleList as $role) { $roleList[] = $role; } $portalRoleList = $this->getPortal()->get('portalRoles'); if (!(is_array($portalRoleList) || $portalRoleList instanceof \Traversable)) { throw new Error(); } foreach ($portalRoleList as $role) { $roleList[] = $role; } return $roleList; } protected function getScopeWithAclList() { $scopeList = []; $scopes = $this->getMetadata()->get('scopes'); foreach ($scopes as $scope => $d) { if (empty($d['acl'])) continue; if (empty($d['aclPortal'])) continue; $scopeList[] = $scope; } return $scopeList; } protected function applyDefault(&$table, &$fieldTable) { parent::applyDefault($table, $fieldTable); foreach ($this->getScopeList() as $scope) { if (!isset($table->$scope)) { $table->$scope = false; } } } protected function applyDisabled(&$table, &$fieldTable) { foreach ($this->getScopeList() as $scope) { $d = $this->getMetadata()->get('scopes.' . $scope); if (!empty($d['disabled']) || !empty($d['portalDisabled'])) { $table->$scope = false; unset($fieldTable->$scope); } } } protected function applyAdditional(&$table, &$fieldTable, &$valuePermissionLists) { } }