예제 #1
0
 /**
  * Add a new role to the ACL
  *
  */
 public function addAction()
 {
     $form = new Ot_Form_Role();
     if ($this->_request->isPost()) {
         if ($form->isValid($_POST)) {
             $data = array('name' => $form->getValue('name'), 'inheritRoleId' => $form->getValue('inheritRoleId'), 'editable' => 1);
             $role = new Ot_Model_DbTable_Role();
             $roleId = $role->insert($data);
             $logOptions = array('attributeName' => 'accessRole', 'attributeId' => $roleId);
             $this->_helper->log(Zend_Log::INFO, 'Role ' . $data['name'] . ' was added', $logOptions);
             $this->_helper->redirector->gotoRoute(array('controller' => 'acl', 'action' => 'details', 'roleId' => $roleId), 'ot', true);
         } else {
             $this->_helper->messenger->addError('msg-error-invalidForm');
         }
     }
     $this->view->form = $form;
     $this->_helper->pageTitle("ot-acl-add:title");
 }