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