Fixed editing simple ACLs
authorAlexander Ebert <ebert@woltlab.com>
Thu, 23 Jun 2016 16:03:07 +0000 (18:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 23 Jun 2016 16:03:14 +0000 (18:03 +0200)
wcfsetup/install/files/lib/acp/form/PageAddForm.class.php
wcfsetup/install/files/lib/system/acl/simple/SimpleAclHandler.class.php

index 95770c53437a26adf2489b3e112f42ad1fd46259..c5dcc8c85279d4e58691004294b9ac302a238283 100644 (file)
@@ -443,7 +443,7 @@ class PageAddForm extends AbstractForm {
                }
                
                // save acl
-               SimpleAclHandler::getInstance()->setValues('com.woltlab.wcf.page', $page->pageID, $_POST);
+               SimpleAclHandler::getInstance()->setValues('com.woltlab.wcf.page', $page->pageID, $this->aclValues);
                
                // call saved event
                $this->saved();
index 001524eb6ccbf6a47a6a0fc52b596cf2b615d33f..3d4c4896eb7649e4044ee09a5d45af7d0bc2ce12 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\system\acl\simple;
 use wcf\data\object\type\ObjectType;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\data\user\group\UserGroup;
+use wcf\data\user\User;
 use wcf\system\cache\runtime\UserRuntimeCache;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
@@ -201,11 +202,23 @@ class SimpleAclHandler extends SingletonFactory {
                
                if (isset($rawValues['allowAll']) && $rawValues['allowAll'] == 0) {
                        if (!empty($rawValues['user'])) {
-                               $aclValues['user'] = UserRuntimeCache::getInstance()->getObjects($rawValues['user']);
+                               $first = current($rawValues['user']);
+                               if ($first instanceof User) {
+                                       $aclValues['user'] = $rawValues['user'];
+                               }
+                               else {
+                                       $aclValues['user'] = UserRuntimeCache::getInstance()->getObjects($rawValues['user']);
+                               }
                        }
                        
                        if (!empty($rawValues['group'])) {
-                               $aclValues['group'] = UserGroup::getGroupsByIDs($rawValues['group']);
+                               $first = current($rawValues['group']);
+                               if ($first instanceof UserGroup) {
+                                       $aclValues['group'] = $rawValues['group'];
+                               }
+                               else {
+                                       $aclValues['group'] = UserGroup::getGroupsByIDs($rawValues['group']);
+                               }
                        }
                        
                        if (!empty($aclValues['user']) || !empty($aclValues['group'])) {