Improved handling of newer permissions for built-in groups
authorAlexander Ebert <ebert@woltlab.com>
Tue, 26 Sep 2017 16:05:29 +0000 (18:05 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 26 Sep 2017 16:05:29 +0000 (18:05 +0200)
wcfsetup/install/files/acp/templates/userGroupBooleanOptionType.tpl
wcfsetup/install/files/acp/templates/userGroupOption.tpl
wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php

index 8f04b0e63d1eddae743b515cb6790fbe18e1f629..4555982eaa03e1ae44cace3b368507e4d7960b50 100644 (file)
@@ -7,7 +7,7 @@
                <input type="radio" id="{$option->optionName}_no"{if $value == 0} checked{/if} name="values[{$option->optionName}]" value="0"{if $disableOptions || $enableOptions} class="jsEnablesOptions" data-is-boolean="true" data-disable-options="[ {@$disableOptions}]" data-enable-options="[ {@$enableOptions}]"{/if}>
                <label for="{$option->optionName}_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.acp.option.type.boolean.no{/lang}</label>
        </li>
-       {if $option->optionName|mb_strpos:'admin.' !== 0 && ($group === null || !$group->isEveryone())}
+       {if $option->optionName|mb_strpos:'admin.' !== 0 && ($group === null || (!$group->isEveryone() && !$group->isUsers()))}
                <li>
                        <input type="radio" id="{$option->optionName}_never"{if $value == -1} checked{/if} name="values[{$option->optionName}]" value="-1"{if $disableOptions || $enableOptions} class="jsEnablesOptions" data-is-boolean="true" data-disable-options="[ {@$disableOptions}]" data-enable-options="[ {@$enableOptions}]"{/if}>
                        <label for="{$option->optionName}_never" class="yellow"><span class="icon icon16 fa-ban"></span> {lang}wcf.acp.option.type.boolean.never{/lang}</label>
index fb9ba58a50225acd31fce597ac8c2e06fe3f8ce1..3e5f28dc4c4a419af3bb0dfd85b421de527d09fd 100644 (file)
@@ -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') || '';
index 489c3523cad6468b27d4d33ed9bedc794c3dc6ee..435b2e4d669bc9cc8e3e0892cbf83784d5fd48ff 100644 (file)
@@ -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);
                }
        }
index 5ba4bba84a46921c901908641dbab2fde7e91989..12bae413a82e6ae600d6d1655c5120246237d0bb 100644 (file)
@@ -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.
         *