示例#1
0
 /**
  * Tears down the fixture, for example, closes a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     foreach ($this->deleteArray as $delete) {
         if (class_exists('UserEditor') && $delete instanceof User) {
             UserEditor::deleteUsers(array($delete->userID));
         } else {
             if (class_exists('GroupEditor') && $delete instanceof Group) {
                 GroupEditor::deleteGroups(array($delete->groupID));
             } else {
                 $delete->delete();
             }
         }
     }
     chdir($this->returndir);
 }
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.user.canDeleteGroup');
     require_once WCF_DIR . 'lib/data/user/group/GroupEditor.class.php';
     if ($this->groupID !== 0) {
         $this->groupIDs[] = $this->groupID;
     }
     // check permission
     if (!Group::isAccessibleGroup($this->groupIDs)) {
         throw new PermissionDeniedException();
     }
     // check master password
     WCFACP::checkMasterPassword();
     $deletedGroups = GroupEditor::deleteGroups($this->groupIDs);
     $this->executed();
     HeaderUtil::redirect('index.php?page=GroupList&deletedGroups=' . $deletedGroups . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }