From: Alexander Ebert Date: Thu, 11 Apr 2019 11:20:23 +0000 (+0200) Subject: Exclude the owner group from bulk actions X-Git-Tag: 5.2.0_Alpha_1~136^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4095fd80f34803b881c0154da2db344ed75b6af9;p=GitHub%2FWoltLab%2FWCF.git Exclude the owner group from bulk actions --- diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php index 3b67e4447f..5a33b51272 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupAssignmentAddForm.class.php @@ -82,7 +82,8 @@ class UserGroupAssignmentAddForm extends AbstractForm { $this->userGroups = UserGroup::getGroupsByType([], [ UserGroup::EVERYONE, UserGroup::GUESTS, - UserGroup::USERS + UserGroup::OWNER, + UserGroup::USERS, ]); foreach ($this->userGroups as $key => $userGroup) { if (!$userGroup->isAccessible()) { diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserBulkProcessingAction.class.php index ad9003140a..41c4836211 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserBulkProcessingAction.class.php @@ -43,9 +43,18 @@ abstract class AbstractUserBulkProcessingAction extends AbstractBulkProcessingAc $statement->execute($conditionBuilder->getParameters()); $groupIDs = $statement->fetchMap('userID', 'groupID', false); + $ownerGroupID = UserGroup::getOwnerGroupID(); + $users = []; foreach ($userList as $user) { - if (empty($groupIDs[$user->userID]) || UserGroup::isAccessibleGroup($groupIDs[$user->userID])) { + if (empty($groupIDs[$user->userID])) { + $users[$user->userID] = $user; + } + else if ($ownerGroupID && in_array($ownerGroupID, $groupIDs[$user->userID])) { + // Bulk actions can never affect members of the owner group. + continue; + } + else if (UserGroup::isAccessibleGroup($groupIDs[$user->userID])) { $users[$user->userID] = $user; } } diff --git a/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php b/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php index ccceecf791..45fe0c346c 100644 --- a/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php +++ b/wcfsetup/install/files/lib/system/bulk/processing/user/AbstractUserGroupsUserBulkProcessingAction.class.php @@ -45,7 +45,7 @@ abstract class AbstractUserGroupsUserBulkProcessingAction extends AbstractUserBu public function __construct(DatabaseObject $object) { parent::__construct($object); - $this->availableUserGroups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]); + $this->availableUserGroups = UserGroup::getAccessibleGroups([], [UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::OWNER, UserGroup::USERS]); uasort($this->availableUserGroups, function(UserGroup $groupA, UserGroup $groupB) { return strcmp($groupA->getName(), $groupB->getName());