summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php6
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php6
2 files changed, 8 insertions, 4 deletions
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index 088b0e6bdb0..ca78297a1a6 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -668,10 +668,10 @@ class UsersController extends OCSController {
}
// Check if group exists
if($group === null) {
- throw new OCSException('Group:'.$groupid.' does not exist', 102);
+ throw new OCSException('Group does not exist', 102);
}
// Check if trying to make subadmin of admin group
- if(strtolower($groupid) === 'admin') {
+ if($group->getGID() === 'admin') {
throw new OCSException('Cannot create subadmins for admin group', 103);
}
@@ -713,7 +713,7 @@ class UsersController extends OCSController {
throw new OCSException('Group does not exist', 101);
}
// Check if they are a subadmin of this said group
- if(!$subAdminManager->isSubAdminofGroup($user, $group)) {
+ if(!$subAdminManager->isSubAdminOfGroup($user, $group)) {
throw new OCSException('User is not a subadmin of this group', 102);
}
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index 42c94f095f6..766c92c9648 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -2238,7 +2238,7 @@ class UsersControllerTest extends TestCase {
/**
* @expectedException \OCP\AppFramework\OCS\OCSException
* @expectedExceptionCode 102
- * @expectedExceptionMessage Group:NotExistingGroup does not exist
+ * @expectedExceptionMessage Group does not exist
*/
public function testAddSubAdminWithNotExistingTargetGroup() {
@@ -2265,6 +2265,10 @@ class UsersControllerTest extends TestCase {
public function testAddSubAdminToAdminGroup() {
$targetUser = $this->getMockBuilder('\OCP\IUser')->disableOriginalConstructor()->getMock();
$targetGroup = $this->getMockBuilder('\OCP\IGroup')->disableOriginalConstructor()->getMock();
+ $targetGroup
+ ->expects($this->once())
+ ->method('getGID')
+ ->will($this->returnValue('admin'));
$this->userManager
->expects($this->once())
->method('get')