aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Middleware
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-07-22 11:41:29 +0200
committerCarl Schwan <carl@carlschwan.eu>2021-09-29 21:43:31 +0200
commit6958d8005ae3b86759f49746564bf7238456be52 (patch)
treeaab851e09351c631129e4729aa49c03533ce6180 /tests/lib/AppFramework/Middleware
parentee987d74303cb38b864f96660cd2ee6d6552ebfd (diff)
downloadnextcloud-server-6958d8005ae3b86759f49746564bf7238456be52.tar.gz
nextcloud-server-6958d8005ae3b86759f49746564bf7238456be52.zip
Add admin privilege delegation for admin settings
This makes it possible for selected groups to access some settings pages. Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'tests/lib/AppFramework/Middleware')
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index 8f55f90d377..bf84a631f74 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -32,6 +32,7 @@ use OC\AppFramework\Middleware\Security\Exceptions\SecurityException;
use OC\Appframework\Middleware\Security\Exceptions\StrictCookieMissingException;
use OC\AppFramework\Middleware\Security\SecurityMiddleware;
use OC\AppFramework\Utility\ControllerMethodReflector;
+use OC\Settings\AuthorizedGroupMapper;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
@@ -42,6 +43,7 @@ use OCP\IL10N;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IURLGenerator;
+use OCP\IUserSession;
use OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;
@@ -69,10 +71,16 @@ class SecurityMiddlewareTest extends \Test\TestCase {
private $appManager;
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
private $l10n;
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
+ private $userSession;
+ /** @var AuthorizedGroupMapper|\PHPUnit\Framework\MockObject\MockObject */
+ private $authorizedGroupMapper;
protected function setUp(): void {
parent::setUp();
+ $this->authorizedGroupMapper = $this->createMock(AuthorizedGroupMapper::class);
+ $this->userSession = $this->createMock(IUserSession::class);
$this->controller = $this->createMock(Controller::class);
$this->reader = new ControllerMethodReflector();
$this->logger = $this->createMock(LoggerInterface::class);
@@ -102,7 +110,9 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$isAdminUser,
$isSubAdmin,
$this->appManager,
- $this->l10n
+ $this->l10n,
+ $this->authorizedGroupMapper,
+ $this->userSession
);
}