diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-08 20:11:20 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-08 20:11:20 +0100 |
commit | ea227aadf2c1b2c326b3aedc9a9bf39d4093ad40 (patch) | |
tree | 8203578e504cde7681f7292b71b732e3feb36fa1 /apps | |
parent | 1f21f0eb7334730a11b51f8bbef84253add765b3 (diff) | |
parent | 3327857c1ad21b022a1c35a01bee798328139ed8 (diff) | |
download | nextcloud-server-ea227aadf2c1b2c326b3aedc9a9bf39d4093ad40.tar.gz nextcloud-server-ea227aadf2c1b2c326b3aedc9a9bf39d4093ad40.zip |
Merge pull request #20961 from owncloud/provis-api-group-special-char
Remove unnecessary group name validation in provisioning_api
Diffstat (limited to 'apps')
-rw-r--r-- | apps/provisioning_api/lib/groups.php | 4 | ||||
-rw-r--r-- | apps/provisioning_api/tests/groupstest.php | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/apps/provisioning_api/lib/groups.php b/apps/provisioning_api/lib/groups.php index 7a6e6150782..b54041ac0f2 100644 --- a/apps/provisioning_api/lib/groups.php +++ b/apps/provisioning_api/lib/groups.php @@ -130,8 +130,8 @@ class Groups{ public function addGroup($parameters) { // Validate name $groupId = $this->request->getParam('groupid', ''); - if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $groupId ) || empty($groupId)){ - \OCP\Util::writeLog('provisioning_api', 'Attempt made to create group using invalid characters.', \OCP\Util::ERROR); + if(empty($groupId)){ + \OCP\Util::writeLog('provisioning_api', 'Group name not supplied', \OCP\Util::ERROR); return new OC_OCS_Result(null, 101, 'Invalid group name'); } // Check if it exists diff --git a/apps/provisioning_api/tests/groupstest.php b/apps/provisioning_api/tests/groupstest.php index f4f3b194944..7f84b3015ff 100644 --- a/apps/provisioning_api/tests/groupstest.php +++ b/apps/provisioning_api/tests/groupstest.php @@ -373,6 +373,27 @@ class GroupsTest extends \Test\TestCase { $this->assertTrue($result->succeeded()); } + public function testAddGroupWithSpecialChar() { + $this->request + ->method('getParam') + ->with('groupid') + ->willReturn('Iñtërnâtiônàlizætiøn'); + + $this->groupManager + ->method('groupExists') + ->with('Iñtërnâtiônàlizætiøn') + ->willReturn(false); + + $this->groupManager + ->expects($this->once()) + ->method('createGroup') + ->with('Iñtërnâtiônàlizætiøn'); + + $result = $this->api->addGroup([]); + $this->assertInstanceOf('OC_OCS_Result', $result); + $this->assertTrue($result->succeeded()); + } + public function testDeleteGroupNonExisting() { $result = $this->api->deleteGroup([ 'groupid' => 'NonExistingGroup' |