/**
  * List view of user attributes
  */
 public function indexAction($dispatch = TRUE)
 {
     //var_dump($this->_getRequest()->getPostParameters());
     // VO selected?
     $this->getSelectedVO();
     // dispatch
     if ($dispatch) {
         $this->dispatchAction($this->_getRequest()->getPostParameters());
     }
     // index action
     $params = Surfnet_Search_Parameters::create();
     $params->addSearchParam('vo_id', $this->m_vo_id);
     $service = new VoManage_Service_VirtualOrganisationAttribute();
     $results = $service->listSearch($params);
     $resultSet = $results->getResults();
     $this->vo_id = $this->m_vo_id;
     $spList = $this->getServiceProviders();
     foreach ($resultSet as $key => &$record) {
         $record['sp_entity_id_display'] = isset($spList[$record['sp_entity_id']]) ? $spList[$record['sp_entity_id']]['id_display'] : '- unknown -';
     }
     // sort
     $resultSet = $this->sortByColumn($resultSet, 'sp_entity_id_display');
     // assign to view
     $this->resultSet = $resultSet;
 }
 public function init()
 {
     $action = $this->getRequest()->getActionName();
     $this->view->identity = $this->_helper->Authenticate();
     $this->_helper->ContextSwitch()->addActionContext($action, array('json', 'json-export', 'csv-export'))->initContext();
     $this->_inputFilter = $this->_helper->FilterLoader();
     $this->_searchParams = Surfnet_Search_Parameters::create($this->_inputFilter);
     $this->_initExportParameters();
     $this->view->gridConfig = $this->_helper->gridSetup($this->_inputFilter);
     $this->_helper->ContextSwitch()->setGridConfig($this->view->gridConfig);
 }
 public function showByCapabilityAction()
 {
     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 Portal_Service_GadgetDefinition();
     $results = $service->searchCountByCapabililty($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 listAction()
 {
     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 EngineBlock_Service_GroupProvider();
     $results = $service->listSearch($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();
     $this->view->addUrl = $this->view->url(array('action' => 'add'));
     $this->view->editUrl = $this->view->url(array('action' => 'edit'));
 }
 public function listAction()
 {
     $inputFilter = $this->_helper->FilterLoader();
     $params = Surfnet_Search_Parameters::create()->setLimit($inputFilter->results)->setOffset($inputFilter->startIndex)->setSortByField($inputFilter->sort)->setSortDirection($inputFilter->dir);
     $searchParams = $this->_getParam('search');
     if (!empty($searchParams)) {
         foreach ($searchParams as $searchKey => $searchParam) {
             $params->addSearchParam($searchKey, $searchParam);
         }
     }
     $service = new Portal_Service_Gadget();
     $results = $service->search($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 listAction()
 {
     $inputFilter = $this->_helper->FilterLoader();
     $params = Surfnet_Search_Parameters::create()->setLimit($inputFilter->results)->setOffset($inputFilter->startIndex)->setSortDirection($inputFilter->dir);
     $searchParams = $this->_getParam('search');
     if (!empty($searchParams)) {
         foreach ($searchParams as $searchKey => $searchParam) {
             $params->addSearchParam($searchKey, $searchParam);
         }
     }
     $service = new EngineBlock_Service_EmailConfiguration();
     $results = $service->search($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();
     $this->view->addUrl = $this->view->url(array('action' => 'add'));
     $this->view->editUrl = $this->view->url(array('action' => '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;
 }
 public function setUp()
 {
     $this->_params = Surfnet_Search_Parameters::create();
 }
Ejemplo n.º 10
0
 /**
  * Tabs with a team connected to it.
  *
  * @param Integer $timestamp timestamp to determine the month
  *                this KPI covers.
  * @return Integer
  */
 public function getTeamTabs($timestamp)
 {
     /**
      * Teamtabs KPI per month
      * The timestamps are in milliseconds.
      */
     $date = getdate($timestamp);
     $searchFields = array('year' => $date['year'], 'month' => $date['mon']);
     $params = Surfnet_Search_Parameters::create()->setSearchParams($searchFields);
     $service = new Portal_Service_Tab();
     $results = $service->searchTeams($params)->getResults();
     return $results[0]['num'];
 }
 public function editAction()
 {
     $this->view->vo_id = htmlentities($this->_getParam('vo_id'));
     $service = new EngineBlock_Service_VirtualOrganisation();
     $this->view->virtualOrganisation = $service->fetchById($this->view->vo_id);
     // rebuild clean urls to prevent "/vo_id/..." in the urls when returning from group editing:
     $this->view->saveUrl = $this->view->url(array('module' => 'engineblock', 'controller' => 'virtual-organisation', 'action' => 'save'), null, true);
     $this->view->listUrl = $this->view->url(array('module' => 'engineblock', 'controller' => 'virtual-organisation', 'action' => 'list'), null, true);
     $this->view->gridData = array();
     $voType = $this->view->virtualOrganisation->vo_type;
     if (in_array($voType, array('GROUP', 'MIXED'))) {
         // groups grid
         $inputFilter = $this->_helper->FilterLoader('groups');
         $params = Surfnet_Search_Parameters::create()->setLimit($inputFilter->results)->setOffset($inputFilter->startIndex)->setSortByField($inputFilter->sort)->setSortDirection($inputFilter->dir);
         $service = new EngineBlock_Service_VirtualOrganisationGroup();
         $groupRecords = $service->listSearch($params, $this->view->vo_id);
         $this->view->gridData['groups'] = array('gridConfig' => $this->_helper->gridSetup($inputFilter, 'groups'));
     }
     if (in_array($voType, array('STEM'))) {
         $config = $this->getFrontController()->getParam('bootstrap')->getApplication()->getOptions();
         $voPrefix = $config['engineBlock']['vo']['stemPrefix'];
         $this->view->voStem = $voPrefix . $this->view->virtualOrganisation->vo_id;
         // Do nothing, since we only have to display the stem name
     }
     if (in_array($voType, array('IDP', 'MIXED'))) {
         // idps grid
         $inputFilter = $this->_helper->FilterLoader('idps');
         $params = Surfnet_Search_Parameters::create()->setLimit($inputFilter->results)->setOffset($inputFilter->startIndex)->setSortByField($inputFilter->sort)->setSortDirection($inputFilter->dir);
         $service = new EngineBlock_Service_VirtualOrganisationIdp();
         $idpRecords = $service->listSearch($params, $this->view->vo_id);
         $this->view->gridData['idps'] = array('gridConfig' => $this->_helper->gridSetup($inputFilter, 'idps'));
     }
     // json context dependent variables
     if ($this->_getParam('format') == 'json') {
         $this->view->gridid = $this->_getParam('gridid');
         switch ($this->view->gridid) {
             case 'groups':
                 $this->view->ResultSet = $this->view->virtualOrganisation->groups;
                 //$results->getResults();
                 $this->view->startIndex = $groupRecords->getParameters()->getOffset();
                 $this->view->recordsReturned = $groupRecords->getResultCount();
                 $this->view->totalRecords = $groupRecords->getTotalCount();
                 $this->view->addUrl = $this->view->url(array('action' => 'groupadd'));
                 $this->view->editUrl = $this->view->url(array('action' => 'groupedit'));
                 break;
             case 'idps':
                 $this->view->ResultSet = $this->view->virtualOrganisation->idps;
                 //$results->getResults();
                 $this->view->startIndex = $idpRecords->getParameters()->getOffset();
                 $this->view->recordsReturned = $idpRecords->getResultCount();
                 $this->view->totalRecords = $idpRecords->getTotalCount();
                 $this->view->addUrl = $this->view->url(array('action' => 'idpadd'));
                 $this->view->editUrl = $this->view->url(array('action' => 'idpedit'));
                 break;
             default:
                 break;
         }
     } else {
         $this->view->ResultSet = array();
     }
 }