summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorTom Needham <tom@owncloud.com>2015-12-04 13:21:24 +0000
committerMorris Jobke <hey@morrisjobke.de>2016-01-08 13:35:00 +0100
commit673a8a1e4a15edb3e6199432fc7e53714a651bb3 (patch)
treef3c052aa13402e9ad9decf793922fc753cfd7d9d /apps
parenta0345b94650f9ded7b86d53b27624557868747e4 (diff)
downloadnextcloud-server-673a8a1e4a15edb3e6199432fc7e53714a651bb3.tar.gz
nextcloud-server-673a8a1e4a15edb3e6199432fc7e53714a651bb3.zip
Remove unnecessary group name validation
Diffstat (limited to 'apps')
-rw-r--r--apps/provisioning_api/lib/groups.php2
-rw-r--r--apps/provisioning_api/tests/groupstest.php21
2 files changed, 22 insertions, 1 deletions
diff --git a/apps/provisioning_api/lib/groups.php b/apps/provisioning_api/lib/groups.php
index 7a6e6150782..633e35357dd 100644
--- a/apps/provisioning_api/lib/groups.php
+++ b/apps/provisioning_api/lib/groups.php
@@ -130,7 +130,7 @@ class Groups{
public function addGroup($parameters) {
// Validate name
$groupId = $this->request->getParam('groupid', '');
- if( preg_match( '/[^a-zA-Z0-9 _\.@\-]/', $groupId ) || empty($groupId)){
+ if(empty($groupId)){
\OCP\Util::writeLog('provisioning_api', 'Attempt made to create group using invalid characters.', \OCP\Util::ERROR);
return new OC_OCS_Result(null, 101, 'Invalid group name');
}
diff --git a/apps/provisioning_api/tests/groupstest.php b/apps/provisioning_api/tests/groupstest.php
index f4f3b194944..84950d923e4 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('NewGroup')
+ ->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'