public function showByTypeAction() { $service = new ServiceRegistry_Service_JanusEntity(); $results = $service->searchIdps($this->_searchParams); $this->view->ResultSet = $results->getResults(); $this->view->startIndex = $results->getParameters()->getOffset(); $this->view->recordsReturned = $results->getResultCount(); $this->view->totalRecords = $results->getTotalCount(); }
/** * Get the number of connected provider types (IdP or Sp) * for the month $timestamp * * @param Integer $timestamp * @return Array */ public function getConnectedProviderTypes($timestamp) { $date = getdate($timestamp); $searchFields = array('year' => $date['year'], 'month' => $date['mon']); $params = Surfnet_Search_Parameters::create()->setSearchParams($searchFields); $service = new ServiceRegistry_Service_JanusEntity(); $providerTypes = $service->searchCountTypes($params)->getResults(); return array('idp' => $providerTypes[0]["num"], 'sp' => $providerTypes[1]["num"]); }
public function showForSpAction() { $entityId = $this->getRequest()->getParam('eid', false); if (!$entityId) { throw new Exception('No entity ID provided!'); } $service = new ServiceRegistry_Service_JanusEntity(); $this->view->ResultSet = $service->getAllowedConnections($entityId); $this->view->entity = $service->fetchByEntityId($entityId); }
public function showByTypeAction() { if ($this->getRequest()->getParam('download', false)) { $this->getResponse()->setHeader('Content-disposition', 'attachment; filename=json.txt'); } $service = new ServiceRegistry_Service_JanusEntity(); $results = $service->searchSps($this->_searchParams); $this->view->ResultSet = $results->getResults(); $this->view->startIndex = $results->getParameters()->getOffset(); $this->view->recordsReturned = $results->getResultCount(); $this->view->totalRecords = $results->getTotalCount(); }
public function showByTypeAction() { if ($this->getRequest()->getParam('download', false)) { $this->getResponse()->setHeader('Content-disposition', 'attachment; filename=json.txt'); } $inputFilter = $this->_helper->FilterLoader(); $params = Surfnet_Search_Parameters::create()->setLimit($inputFilter->results)->setOffset($inputFilter->startIndex)->setSortByField($inputFilter->sort)->setSortDirection($inputFilter->dir); $service = new ServiceRegistry_Service_JanusEntity(); $results = $service->searchCountTypes($params); $this->view->gridConfig = $this->_helper->gridSetup($inputFilter); $this->view->ResultSet = $results->getResults(); $this->view->startIndex = $results->getParameters()->getOffset(); $this->view->recordsReturned = $results->getResultCount(); $this->view->totalRecords = $results->getTotalCount(); }
public function showSpByGroupproviderAction() { $service = new EngineBlock_Service_ServiceProviderGroupAcl(); $groupProviderId = (int) $this->_getParam('id'); $groupProviderAbr = $this->_getParam('abr'); $groupProviderName = $this->_getParam('name'); $spsAclFromDb = $service->findByGroupProviderId($groupProviderId); $janus = new ServiceRegistry_Service_JanusEntity(); /* * An array of arrays where we want the key 'entityid' of the value array */ $spsFromJanus = $janus->searchSps(Surfnet_Search_Parameters::create())->getResults(); $results = array(); /* * now delete those spAcl's that have no corresponding Janus SP entry */ foreach ($spsAclFromDb as $spAcl) { if (!$this->_hasExistingJanusSP($spsFromJanus, $spAcl)) { $service->delete($spAcl->id); } else { $results[] = $spAcl; } } /* * now create an Acl if there is a Janus entry but no corresponding ServiceProviderGroupAcl */ $mapper = new EngineBlock_Model_Mapper_ServiceProviderGroupAcl(new EngineBlock_Model_DbTable_ServiceProviderGroupAcl()); foreach ($spsFromJanus as $spJanus) { $spEntityId = $this->_getMissingSpAclEntityId($spsAclFromDb, $spJanus); if ($spEntityId) { $model = new EngineBlock_Model_ServiceProviderGroupAcl(); $model->allow_groups = false; $model->allow_members = false; $model->groupProviderId = $groupProviderId; $model->spentityid = $spEntityId; $model->id = $mapper->save($model); $results[] = $model; } } $this->view->serviceProviderAcls = $results; $this->view->groupProvider = array('id' => $groupProviderId, 'abr' => $groupProviderAbr, 'name' => $groupProviderName); $this->render('edit'); }
public function getAllowedConnections($entityId) { $service = new ServiceRegistry_Service_JanusEntity(); $fromEntity = $service->fetchByEntityId($entityId); $entities = array(); // get all entities from other type if ($fromEntity['type'] === "saml20-idp") { $results = $service->searchSps(Surfnet_Search_Parameters::create()); $entities = $results->getResults(); } else { $results = $service->searchIdps(Surfnet_Search_Parameters::create()); $entities = $results->getResults(); } $entitiesResult = array(); foreach ($entities as $entity) { if ($service->isConnectionAllowed($fromEntity, $entity) && $service->isConnectionAllowed($entity, $fromEntity)) { $entitiesResult[] = $entity; } } return $entitiesResult; }