Ejemplo n.º 1
0
 /**
  * Function to handle index request on /policy
  * Fills out the policy-list view with policies, apis and auths
  * retrieved from E3.
  */
 public function indexAction()
 {
     //        //print_r("indexAction");
     $this->view->messages = $this->getZendFlashMessenger()->getMessages();
     $this->view->apis = $this->policyManager->getAllApis(true);
     $this->view->auths = $this->policyManager->getAllAuths(true);
     $this->view->policies = $this->policyManager->getAllPolicies(true);
 }
 /**
  * Handle the delete-Policy action
  */
 public function deleteAction()
 {
     $this->policyManager->deletePolicy($this->_getParam("id"));
     $this->getZendFlashMessenger()->addMessage(PolicyController::translate("Deleted Policy"));
     $this->_redirect("/policy");
 }
 /**
  * This is the on-enter callback for the "form" state
  * It will load the object needed to back the form.
  * @param $action
  * @param $flowScope
  */
 public function loadFormBacker($action, &$flowScope)
 {
     // Default to using the id from the $flowScope
     $id = @$flowScope['policyId'];
     // If that is empty then we use the one from the request
Ejemplo n.º 2
0
 /**
  * Callback function for the on-exit of the Auth subflow
  * We have already created the API and the Auth(s) so now we need to create a Policy
  * to hook them together
  * @param $action
  * @param $flowScope
  */
 public function postAuthSubflow($action, &$flowScope)
 {
     $registry = Zend_Registry::getInstance();
     $translate = $registry->get("Zend_Translate");
     $authIds = $flowScope['authIds'];
     /**  @var Api $api*/
     $api = $flowScope['api'];
     $policy = PolicyController::createBasicPolicy(null, array($api->id), $authIds);
     $pm = new PolicyManager();
     $result = $pm->createPolicy($policy);
     if ($result) {
         $this->_helper->FlashMessenger($translate->translate("Policy Created: ") . $policy->id);
     } else {
         $this->_helper->FlashMessenger($translate->translate("Error creating Policy"));
     }
 }