summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php9
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php33
2 files changed, 5 insertions, 37 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index 1db4c96b752..c09f1617f40 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -340,7 +340,7 @@ class UsersController extends OCSController {
$data['storageLocation'] = $targetUserObject->getHome();
$data['lastLogin'] = $targetUserObject->getLastLogin() * 1000;
$data['backend'] = $targetUserObject->getBackendClassName();
- $data['subadmins'] = $this->getUserSubAdminGroupsData($targetUserObject->getUID());
+ $data['subadmin'] = $this->getUserSubAdminGroupsData($targetUserObject->getUID());
$data['quota'] = $this->fillStorageInfo($targetUserObject->getUID());
$data[AccountManager::PROPERTY_EMAIL] = $targetUserObject->getEMailAddress();
$data[AccountManager::PROPERTY_DISPLAYNAME] = $targetUserObject->getDisplayName();
@@ -852,12 +852,7 @@ class UsersController extends OCSController {
*/
public function getUserSubAdminGroups(string $userId): DataResponse {
$groups = $this->getUserSubAdminGroupsData($userId);
-
- if(is_array($groups)) {
- throw new OCSException('Unknown error occurred', 102);
- } else {
- return new DataResponse($groups);
- }
+ return new DataResponse($groups);
}
/**
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 83be63c49a5..38e35988137 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -765,7 +765,7 @@ class UsersControllerTest extends TestCase {
'storageLocation' => '/var/www/newtcloud/data/UID',
'lastLogin' => 1521191471000,
'backend' => 'Database',
- 'subadmins' => ['group3'],
+ 'subadmin' => ['group3'],
'quota' => ['DummyValue'],
'email' => 'demo@nextcloud.com',
'displayname' => 'Demo User',
@@ -880,7 +880,7 @@ class UsersControllerTest extends TestCase {
'storageLocation' => '/var/www/newtcloud/data/UID',
'lastLogin' => 1521191471000,
'backend' => 'Database',
- 'subadmins' => [],
+ 'subadmin' => [],
'quota' => ['DummyValue'],
'email' => 'demo@nextcloud.com',
'displayname' => 'Demo User',
@@ -1035,7 +1035,7 @@ class UsersControllerTest extends TestCase {
'storageLocation' => '/var/www/newtcloud/data/UID',
'lastLogin' => 1521191471000,
'backend' => 'Database',
- 'subadmins' => [],
+ 'subadmin' => [],
'quota' => ['DummyValue'],
'email' => 'subadmin@nextcloud.com',
'displayname' => 'Subadmin User',
@@ -2853,33 +2853,6 @@ class UsersControllerTest extends TestCase {
$this->assertEquals(['TargetGroup'], $this->api->getUserSubAdminGroups('RequestedUser')->getData());
}
- /**
- * @expectedException \OCP\AppFramework\OCS\OCSException
- * @expectedExceptionCode 102
- * @expectedExceptionMessage Unknown error occurred
- */
- public function testGetUserSubAdminGroupsWithoutGroups() {
- $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
- $this->userManager
- ->expects($this->once())
- ->method('get')
- ->with('RequestedUser')
- ->will($this->returnValue($targetUser));
- $subAdminManager = $this->getMockBuilder('OC\SubAdmin')
- ->disableOriginalConstructor()->getMock();
- $subAdminManager
- ->expects($this->once())
- ->method('getSubAdminsGroups')
- ->with($targetUser)
- ->will($this->returnValue([]));
- $this->groupManager
- ->expects($this->once())
- ->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
-
- $this->api->getUserSubAdminGroups('RequestedUser');
- }
-
public function testEnableUser() {
$targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$targetUser->expects($this->once())