aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-08-31 16:00:21 -0100
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>2023-09-01 20:14:52 +0200
commite55087b6b18ec7a8f09d02265060d7b018ad4135 (patch)
tree353672a473ea649032cc9353abb690845eff741d /apps/files_external/tests
parentb0fae951e36976aff1fc606248112f6f495e7359 (diff)
downloadnextcloud-server-e55087b6b18ec7a8f09d02265060d7b018ad4135.tar.gz
nextcloud-server-e55087b6b18ec7a8f09d02265060d7b018ad4135.zip
admin have no special rights on users' entries
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r--apps/files_external/tests/Controller/AjaxControllerTest.php35
1 files changed, 6 insertions, 29 deletions
diff --git a/apps/files_external/tests/Controller/AjaxControllerTest.php b/apps/files_external/tests/Controller/AjaxControllerTest.php
index 2ddd64f0e07..304a1807931 100644
--- a/apps/files_external/tests/Controller/AjaxControllerTest.php
+++ b/apps/files_external/tests/Controller/AjaxControllerTest.php
@@ -102,17 +102,11 @@ class AjaxControllerTest extends TestCase {
->expects($this->once())
->method('getUser')
->willReturn($user);
- $this->groupManager
- ->expects($this->once())
- ->method('isAdmin')
- ->with('MyAdminUid')
- ->willReturn(true);
$this->globalAuth
- ->expects($this->once())
- ->method('saveAuth')
- ->with('UidOfTestUser', 'test', 'password');
+ ->expects($this->never())
+ ->method('saveAuth');
- $this->assertSame(true, $this->ajaxController->saveGlobalCredentials('UidOfTestUser', 'test', 'password'));
+ $this->assertSame(false, $this->ajaxController->saveGlobalCredentials('UidOfTestUser', 'test', 'password'));
}
public function testSaveGlobalCredentialsAsAdminForSelf() {
@@ -125,11 +119,6 @@ class AjaxControllerTest extends TestCase {
->expects($this->once())
->method('getUser')
->willReturn($user);
- $this->groupManager
- ->expects($this->once())
- ->method('isAdmin')
- ->with('MyAdminUid')
- ->willReturn(true);
$this->globalAuth
->expects($this->once())
->method('saveAuth')
@@ -141,20 +130,12 @@ class AjaxControllerTest extends TestCase {
public function testSaveGlobalCredentialsAsNormalUserForSelf() {
$user = $this->createMock(IUser::class);
$user
- ->expects($this->exactly(2))
->method('getUID')
->willReturn('MyUserUid');
$this->userSession
- ->expects($this->once())
->method('getUser')
->willReturn($user);
- $this->groupManager
- ->expects($this->once())
- ->method('isAdmin')
- ->with('MyUserUid')
- ->willReturn(false);
$this->globalAuth
- ->expects($this->once())
->method('saveAuth')
->with('MyUserUid', 'test', 'password');
@@ -164,18 +145,14 @@ class AjaxControllerTest extends TestCase {
public function testSaveGlobalCredentialsAsNormalUserForAnotherUser() {
$user = $this->createMock(IUser::class);
$user
- ->expects($this->exactly(2))
->method('getUID')
->willReturn('MyUserUid');
$this->userSession
- ->expects($this->once())
->method('getUser')
->willReturn($user);
- $this->groupManager
- ->expects($this->once())
- ->method('isAdmin')
- ->with('MyUserUid')
- ->willReturn(false);
+ $this->globalAuth
+ ->expects($this->never())
+ ->method('saveAuth');
$this->assertSame(false, $this->ajaxController->saveGlobalCredentials('AnotherUserUid', 'test', 'password'));
}