summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-08 20:11:20 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-08 20:11:20 +0100
commitea227aadf2c1b2c326b3aedc9a9bf39d4093ad40 (patch)
tree8203578e504cde7681f7292b71b732e3feb36fa1 /apps
parent1f21f0eb7334730a11b51f8bbef84253add765b3 (diff)
parent3327857c1ad21b022a1c35a01bee798328139ed8 (diff)
downloadnextcloud-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.php4
-rw-r--r--apps/provisioning_api/tests/groupstest.php21
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'