From ace09b19e3e30c30f7c5980862760c06fdd4dace Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 26 Sep 2017 18:05:29 +0200 Subject: [PATCH] Improved handling of newer permissions for built-in groups --- .../files/acp/templates/userGroupBooleanOptionType.tpl | 2 +- .../install/files/acp/templates/userGroupOption.tpl | 2 +- .../files/lib/acp/form/UserGroupOptionForm.class.php | 5 +++++ .../files/lib/data/user/group/UserGroup.class.php | 10 ++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/userGroupBooleanOptionType.tpl b/wcfsetup/install/files/acp/templates/userGroupBooleanOptionType.tpl index 8f04b0e63d..4555982eaa 100644 --- a/wcfsetup/install/files/acp/templates/userGroupBooleanOptionType.tpl +++ b/wcfsetup/install/files/acp/templates/userGroupBooleanOptionType.tpl @@ -7,7 +7,7 @@ - {if $option->optionName|mb_strpos:'admin.' !== 0 && ($group === null || !$group->isEveryone())} + {if $option->optionName|mb_strpos:'admin.' !== 0 && ($group === null || (!$group->isEveryone() && !$group->isUsers()))}
  • diff --git a/wcfsetup/install/files/acp/templates/userGroupOption.tpl b/wcfsetup/install/files/acp/templates/userGroupOption.tpl index fb9ba58a50..3e5f28dc4c 100644 --- a/wcfsetup/install/files/acp/templates/userGroupOption.tpl +++ b/wcfsetup/install/files/acp/templates/userGroupOption.tpl @@ -9,7 +9,7 @@ var fragment = document.createDocumentFragment(); fragment.appendChild(container); - var dd, groupId, id, inputElements, isBoolean, label, labels = container.getElementsByTagName('label'); + var dd, groupId, id, inputElement, inputElements, isBoolean, label, labels = container.getElementsByTagName('label'); for (var i = 0, length = labels.length; i < length; i++) { label = labels[i]; id = label.getAttribute('for') || ''; diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php index 489c3523ca..435b2e4d66 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php @@ -12,6 +12,7 @@ use wcf\system\exception\IllegalLinkException; use wcf\system\exception\PermissionDeniedException; use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; +use wcf\system\option\user\group\IUserGroupGroupOptionType; use wcf\system\option\user\group\IUserGroupOptionType; use wcf\system\WCF; @@ -221,6 +222,10 @@ class UserGroupOptionForm extends AbstractForm { // create form elements for each group foreach ($this->groups as $group) { $optionValue = isset($this->values[$group->groupID]) ? $this->values[$group->groupID] : ''; + if ($this->optionType instanceof IUserGroupGroupOptionType) { + $this->optionType->setUserGroup($group); + } + $this->formElements[$group->groupID] = $this->optionType->getFormElement($this->userGroupOption, $optionValue); } } diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index 5ba4bba84a..12bae413a8 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -180,6 +180,16 @@ class UserGroup extends DatabaseObject implements ITitledObject { return $this->groupType == self::EVERYONE; } + /** + * Returns true if this is the 'Users' group. + * + * @return boolean + * @since 3.1 + */ + public function isUsers() { + return $this->groupType == self::USERS; + } + /** * Returns true if the given groups are accessible for the active user. * -- 2.20.1