if ($context != null) {
     $contexts[] = $context;
     $policy->setContexts($contexts);
 }
Exemple #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"));
     }
 }