summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-04-24 10:15:03 +0200
committerJoas Schilling <coding@schilljs.com>2017-04-24 10:15:03 +0200
commite19126425bd24ab0a357bd6eb2673512b49dfef6 (patch)
tree10ddec104364749882f9584561fae5230c7be122 /apps/provisioning_api
parent992c48c89bd71971a3821143aeac7dcb8f616461 (diff)
downloadnextcloud-server-e19126425bd24ab0a357bd6eb2673512b49dfef6.tar.gz
nextcloud-server-e19126425bd24ab0a357bd6eb2673512b49dfef6.zip
Fix similar issues with the group id
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api')
-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')