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 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; }