/** * Load entities that user has access to * * @param null|string Workflow state the entity has to be in * @param null|string Workflow state the entity must NOT be in * @param null|string Field to sort on * @param null|string Direction to sort in ('ASC'|'DESC') * @return bool True on success and false on error. * @since Method available since Release 1.0.0 * @throws Exception if loading fails */ private function _loadEntities($state = null, $state_exclude = null, $sort = null, $order = null) { if (!$this->securityContext->isGranted('allentities')) { $allowedUserId = $this->_user->getUid(); } else { $allowedUserId = null; } $filter = array('state' => $state, 'stateExclude' => $state_exclude, 'allowedUserId' => $allowedUserId); $connectionCollection = $this->connectionService->findDescriptorsForFilters($filter, $sort, $order); $this->_entities = array(); /** @var $connectionDto \Janus\ServiceRegistry\Connection\ConnectionDto */ foreach ($connectionCollection->connections as $connectionDto) { $entity = new sspmod_janus_Entity($this->_config); $entity->setEid($connectionDto->id); $entity->setRevisionid($connectionDto->revisionNr); if (!is_null($state)) { $entity->setWorkflow($state); } if ($entity->load()) { $this->_entities[] = $entity; } else { SimpleSAML_Logger::error('JANUS:UserController:_loadEntities - Entity could not be loaded: ' . var_export($entity, true)); } } return true; }