aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-01-29 22:13:41 +0100
committerGitHub <noreply@github.com>2019-01-29 22:13:41 +0100
commit139055c1ddec25465dd7644de9866cd6a1048da2 (patch)
treeb02635beb3033e482fbb2a0867c497b30c57f117 /apps
parent6b653635a771a0707bae3b6afb89f760faaab8b6 (diff)
parent15abcff2a199f9d80baabbc39778765a2458acd2 (diff)
downloadnextcloud-server-139055c1ddec25465dd7644de9866cd6a1048da2.tar.gz
nextcloud-server-139055c1ddec25465dd7644de9866cd6a1048da2.zip
Merge pull request #13880 from nextcloud/enh/expose_subadmin_to_ocp
Expose subadmin to OCP
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php3
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php14
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php76
3 files changed, 7 insertions, 86 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php
index 8f495698d02..4d5bcea9966 100644
--- a/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php
+++ b/apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php
@@ -28,6 +28,9 @@ use OCA\DAV\CalDAV\Activity\Filter\Todo;
use OCP\Activity\IFilter;
use Test\TestCase;
+/**
+ * @group DB
+ */
class GenericTest extends TestCase {
public function dataFilters() {
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index 67fa32c6fb2..ac1cfe989fd 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -809,11 +809,8 @@ class UsersController extends AUserData {
return new DataResponse();
}
// Go
- if ($subAdminManager->createSubAdmin($user, $group)) {
- return new DataResponse();
- } else {
- throw new OCSException('Unknown error occurred', 103);
- }
+ $subAdminManager->createSubAdmin($user, $group);
+ return new DataResponse();
}
/**
@@ -845,11 +842,8 @@ class UsersController extends AUserData {
}
// Go
- if ($subAdminManager->deleteSubAdmin($user, $group)) {
- return new DataResponse();
- } else {
- throw new OCSException('Unknown error occurred', 103);
- }
+ $subAdminManager->deleteSubAdmin($user, $group);
+ return new DataResponse();
}
/**
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 0d6d811acbc..fcdc68d353b 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -2738,44 +2738,6 @@ class UsersControllerTest extends TestCase {
/**
* @expectedException \OCP\AppFramework\OCS\OCSException
- * @expectedExceptionCode 103
- * @expectedExceptionMessage Unknown error occurred
- */
- public function testAddSubAdminUnsuccessful() {
- $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
- $targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
- $this->userManager
- ->expects($this->once())
- ->method('get')
- ->with('ExistingUser')
- ->will($this->returnValue($targetUser));
- $this->groupManager
- ->expects($this->once())
- ->method('get')
- ->with('TargetGroup')
- ->will($this->returnValue($targetGroup));
- $subAdminManager = $this->getMockBuilder('OC\SubAdmin')
- ->disableOriginalConstructor()->getMock();
- $subAdminManager
- ->expects($this->once())
- ->method('isSubAdminOfGroup')
- ->with($targetUser, $targetGroup)
- ->will($this->returnValue(false));
- $subAdminManager
- ->expects($this->once())
- ->method('createSubAdmin')
- ->with($targetUser, $targetGroup)
- ->will($this->returnValue(false));
- $this->groupManager
- ->expects($this->once())
- ->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
-
- $this->api->addSubAdmin('ExistingUser', 'TargetGroup');
- }
-
- /**
- * @expectedException \OCP\AppFramework\OCS\OCSException
* @expectedExceptionCode 101
* @expectedExceptionMessage User does not exist
*/
@@ -2879,44 +2841,6 @@ class UsersControllerTest extends TestCase {
/**
* @expectedException \OCP\AppFramework\OCS\OCSException
- * @expectedExceptionCode 103
- * @expectedExceptionMessage Unknown error occurred
- */
- public function testRemoveSubAdminUnsuccessful() {
- $targetUser = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
- $targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
- $this->userManager
- ->expects($this->once())
- ->method('get')
- ->with('ExistingUser')
- ->will($this->returnValue($targetUser));
- $this->groupManager
- ->expects($this->once())
- ->method('get')
- ->with('GroupToDeleteFrom')
- ->will($this->returnValue($targetGroup));
- $subAdminManager = $this->getMockBuilder('OC\SubAdmin')
- ->disableOriginalConstructor()->getMock();
- $subAdminManager
- ->expects($this->once())
- ->method('isSubAdminOfGroup')
- ->with($targetUser, $targetGroup)
- ->will($this->returnValue(true));
- $subAdminManager
- ->expects($this->once())
- ->method('deleteSubAdmin')
- ->with($targetUser, $targetGroup)
- ->will($this->returnValue(false));
- $this->groupManager
- ->expects($this->once())
- ->method('getSubAdmin')
- ->will($this->returnValue($subAdminManager));
-
- $this->api->removeSubAdmin('ExistingUser', 'GroupToDeleteFrom');
- }
-
- /**
- * @expectedException \OCP\AppFramework\OCS\OCSException
* @expectedExceptionCode 404
* @expectedExceptionMessage User does not exist
*/