a5731402fb2e0c21934b6cf31e42c1933b74109b
[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 * @inheritDoc
20 */
21 public $inputName = 'removeFromUserGroupIDs';
22
23 /**
24 * @inheritDoc
25 */
26 protected function executeUserAction(UserEditor $user) {
27 $user->removeFromGroups($this->userGroupIDs);
28 }
29
30 /**
31 * @inheritDoc
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 }