/**
  * Cascade delete Role
  * @group admin
  * @group admin-role-cascade-delete
  */
 public function testRoleCascadeDelete()
 {
     print "\n" . __METHOD__ . ' ';
     $role_id = 6;
     $this->_rootLogin();
     $this->request->setPost(array('role_id' => $role_id));
     $this->request->setMethod('POST');
     $this->dispatch('admin/role-delete');
     $this->logBody($this->response->outputBody());
     // debug log
     $this->assertController('admin');
     $this->assertAction('role-index');
     $this->assertNotQueryContentRegex('table', self::ZF_pattern);
     // Zend Framework
     // check role
     Zend_Loader::loadClass('Wbroles');
     $table = new Wbroles();
     $row = $table->fetchRow("id = {$role_id}");
     if ($row != null) {
         $this->assertTrue(FALSE, "\nRole delete fail!\n");
     }
     unset($table);
     // check ACLs tables
     $arr_table = array('WbCommandACL', 'Wbresources', 'WbStorageACL', 'WbPoolACL', 'WbClientACL', 'WbFilesetACL', 'WbJobACL', 'WbWhereACL');
     foreach ($arr_table as $tbl) {
         Zend_Loader::loadClass($tbl);
         $table = new $tbl();
         $row = $table->fetchRow("role_id = {$role_id}");
         if ($row != null) {
             $this->assertTrue(FALSE, "\nRole cascade delete fail!\n");
         }
         echo "0";
         unset($table);
     }
 }
Exemplo n.º 2
0
 public function roleMoreInfoAction()
 {
     $role_id = $this->_request->getParam('role_id');
     if (empty($role_id)) {
         throw new Exception(__METHOD__ . ' : Empty $role_id parameter');
     }
     $this->view->role_id = $role_id;
     // get Role name
     $table = new Wbroles();
     $role = $table->fetchRow($table->getAdapter()->quoteInto('id = ?', $role_id));
     $this->view->title = 'Webacula :: ' . $this->view->translate->_('Role') . ' :: ' . $role->name;
     // inherited roles
     $this->view->inherited_roles = $table->getParentNames($role_id);
     // who use
     $this->view->roles = $table->listWhoRolesUseRole($role_id);
     $this->view->users = $table->listWhoUsersUseRole($role_id);
 }