1fe0d5d512c5e78ec277f2cefc03e3d0640b6055
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\bulk\processing\user;
3 use wcf\data\user\UserEditor;
4 use wcf\system\WCF;
5
6 /**
7 * Bulk processing action implementation for removing users from user groups.
8 *
9 * @author Matthias Schmidt
10 * @copyright 2001-2016 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf
13 * @subpackage system.bulk.processing.user
14 * @category Community Framework
15 * @since 2.2
16 */
17 class RemoveFromUserGroupsUserBulkProcessingAction extends AbstractUserGroupsUserBulkProcessingAction {
18 /**
19 * @see \wcf\system\bulk\processing\user\AbstractUserGroupsUserBulkProcessingAction::$inputName
20 */
21 public $inputName = 'removeFromUserGroupIDs';
22
23 /**
24 * @see \wcf\system\bulk\processing\user\AbstractUserGroupsUserBulkProcessingAction::executeUserAction()
25 */
26 protected function executeUserAction(UserEditor $user) {
27 $user->removeFromGroups($this->userGroupIDs);
28 }
29
30 /**
31 * @see \wcf\system\bulk\processing\IBulkProcessingAction::getObjectList()
32 */
33 public function getObjectList() {
34 $userList = parent::getObjectList();
35
36 // the active user may not remove themselves from any user group
37 // to avoid potential permission issues
38 $userList->getConditionBuilder()->add('user_table.userID <> ?', [WCF::getUser()->userID]);
39
40 return $userList;
41 }
42 }