From e5dc9c47025542115fdd4c205125a8b4daa1e3eb Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 23 Jun 2016 18:03:07 +0200 Subject: [PATCH] Fixed editing simple ACLs --- .../files/lib/acp/form/PageAddForm.class.php | 2 +- .../acl/simple/SimpleAclHandler.class.php | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php index 95770c5343..c5dcc8c852 100644 --- a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php @@ -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(); diff --git a/wcfsetup/install/files/lib/system/acl/simple/SimpleAclHandler.class.php b/wcfsetup/install/files/lib/system/acl/simple/SimpleAclHandler.class.php index 001524eb6c..3d4c4896eb 100644 --- a/wcfsetup/install/files/lib/system/acl/simple/SimpleAclHandler.class.php +++ b/wcfsetup/install/files/lib/system/acl/simple/SimpleAclHandler.class.php @@ -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'])) { -- 2.20.1