2014-12-22 13:54:50 +00:00
|
|
|
<?php
|
2015-02-26 10:37:37 +00:00
|
|
|
|
2014-12-22 13:54:50 +00:00
|
|
|
/**
|
2015-02-26 10:37:37 +00:00
|
|
|
* ownCloud
|
2014-12-22 13:54:50 +00:00
|
|
|
*
|
2015-02-26 10:37:37 +00:00
|
|
|
* @copyright (C) 2014 ownCloud, Inc.
|
2014-12-22 13:54:50 +00:00
|
|
|
*
|
2015-02-26 10:37:37 +00:00
|
|
|
* @author Tom <tom@owncloud.com>
|
2014-12-22 13:54:50 +00:00
|
|
|
*
|
2015-02-26 10:37:37 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
2014-12-22 13:54:50 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-02-26 10:37:37 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
2014-12-22 13:54:50 +00:00
|
|
|
*
|
2015-02-26 10:37:37 +00:00
|
|
|
* You should have received a copy of the GNU Affero General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2014-12-22 13:54:50 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-02-26 10:37:37 +00:00
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
namespace OCA\Provisioning_API\Tests;
|
2014-12-22 13:54:50 +00:00
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
class UsersTest extends TestCase {
|
|
|
|
protected function resetParams() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$_GET = null;
|
|
|
|
$_POST = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test getting the list of users
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUsers() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::getUsers(array());
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$count = $result->getData();
|
|
|
|
$count = count($count['users']);
|
|
|
|
$this->assertEquals(count(\OC_User::getUsers()), $count);
|
|
|
|
|
|
|
|
$user = $this->generateUsers();
|
|
|
|
$_GET['search'] = $user;
|
|
|
|
$result = \OCA\provisioning_API\Users::getUsers(array());
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals($user, reset($data['users']));
|
|
|
|
|
|
|
|
// Add several users
|
|
|
|
$this->generateUsers(10);
|
|
|
|
$this->resetParams();
|
|
|
|
$_GET['limit'] = 2;
|
|
|
|
$result = \OCA\provisioning_API\Users::getUsers(array());
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$count = $result->getData();
|
|
|
|
$count = count($count['users']);
|
|
|
|
$this->assertEquals(2, $count);
|
|
|
|
|
|
|
|
$this->resetParams();
|
|
|
|
$_GET['limit'] = 1;
|
|
|
|
$_GET['offset'] = 1;
|
|
|
|
$result = \OCA\provisioning_API\Users::getUsers(array());
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals(\OC_User::getUsers('', 1, 1), $data['users']);
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAddUser() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$this->resetParams();
|
2015-01-07 09:34:42 +00:00
|
|
|
$_POST['userid'] = $this->getUniqueID();
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['password'] = 'password';
|
|
|
|
$result = \OCA\provisioning_API\Users::addUser(array());
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$this->assertTrue(\OC_User::userExists($_POST['userid']));
|
|
|
|
$this->assertEquals($_POST['userid'], \OC_User::checkPassword($_POST['userid'], $_POST['password']));
|
|
|
|
$this->users[] = $_POST['userid'];
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUserOnSelf() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$params['userid'] = $user;
|
|
|
|
$result = \OCA\provisioning_API\Users::getUser($params);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUserOnNonExistingUser() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$params = array();
|
2015-01-07 09:34:42 +00:00
|
|
|
$params['userid'] = $this->getUniqueID();
|
2014-12-22 13:54:50 +00:00
|
|
|
while(\OC_User::userExists($params['userid'])) {
|
2015-01-07 09:34:42 +00:00
|
|
|
$params['userid'] = $this->getUniqueID();
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
$result = \OCA\provisioning_API\Users::getUser($params);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
$this->assertEquals(\OC_API::RESPOND_NOT_FOUND, $result->getStatusCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUserOnOtherUser() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$users = $this->generateUsers(2);
|
|
|
|
$params['userid'] = $users[0];
|
|
|
|
\OC_User::setUserId($users[1]);
|
|
|
|
$result = \OCA\provisioning_API\Users::getUser($params);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
|
|
|
|
// Now as as admin
|
|
|
|
$users = $this->generateUsers(2);
|
|
|
|
$params['userid'] = $users[0];
|
|
|
|
\OC_Group::addToGroup($users[1], 'admin');
|
|
|
|
\OC_User::setUserId($users[1]);
|
|
|
|
$result = \OCA\provisioning_API\Users::getUser($params);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals(\OC::$server->getConfig()->getUserValue($users[0], 'core', 'enabled', 'true'), $data['enabled']);
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testEditOwnDisplayName() {
|
2014-12-22 13:54:50 +00:00
|
|
|
|
|
|
|
// Test editing own name
|
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'display',
|
|
|
|
'value' => 'newname',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$this->assertEquals('newname', \OC_User::getDisplayName($user));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAdminEditDisplayNameOfUser() {
|
2014-12-22 13:54:50 +00:00
|
|
|
|
|
|
|
// Test admin editing users name
|
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$user2 = $this->generateUsers();
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'display',
|
|
|
|
'value' => 'newname',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$this->assertEquals('newname', \OC_User::getDisplayName($user2));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testUserEditOtherUserDisplayName() {
|
2014-12-22 13:54:50 +00:00
|
|
|
|
|
|
|
// Test editing other users name
|
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$user2 = $this->generateUsers();
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'display',
|
|
|
|
'value' => 'newname',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testEditOwnQuota() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'quota',
|
|
|
|
'value' => '20G',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAdminEditOwnQuota() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'quota',
|
|
|
|
'value' => '20G',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAdminEditOtherUserQuota() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$user2 = $this->generateUsers();
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'quota',
|
|
|
|
'value' => '20G',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testUserEditOtherUserQuota() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$user2 = $this->generateUsers();
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'quota',
|
|
|
|
'value' => '20G',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testUserEditOwnEmail() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
|
|
|
$email = 'test@example.com';
|
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $user,
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'email',
|
|
|
|
'value' => $email,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$this->assertEquals($email, \OC::$server->getConfig()->getUserValue($user, 'settings', 'email', null));
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testUserEditOtherUserEmailAsUser() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$users = $this->generateUsers(2);
|
|
|
|
$email = 'test@example.com';
|
|
|
|
\OC_User::setUserId($users[0]);
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $users[1],
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'email',
|
|
|
|
'value' => $email,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testUserEditOtherUserEmailAsAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$users = $this->generateUsers(2);
|
|
|
|
$email = 'test@example.com';
|
|
|
|
\OC_User::setUserId($users[0]);
|
|
|
|
\OC_Group::addToGroup($users[0], 'admin');
|
|
|
|
$result = \OCA\provisioning_API\Users::editUser(
|
|
|
|
array(
|
|
|
|
'userid' => $users[1],
|
|
|
|
'_put' => array(
|
|
|
|
'key' => 'email',
|
|
|
|
'value' => $email,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$this->assertEquals($email, \OC::$server->getConfig()->getUserValue($users[1], 'settings', 'email', null));
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testDeleteSelf() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::deleteUser(array(
|
|
|
|
'userid' => $user,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testDeleteOtherAsUser() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
|
|
|
$result = \OCA\provisioning_API\Users::deleteUser(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testDeleteOtherAsSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
$group = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
|
|
|
\OC_Group::addToGroup($user, $group);
|
|
|
|
\OC_Group::addToGroup($user2, $group);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user, $group);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::deleteUser(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testDeleteOtherAsIrelevantSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
$group = $this->getUniqueID();
|
|
|
|
$group2 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
|
|
|
\OC_Group::createGroup($group2);
|
|
|
|
\OC_Group::addToGroup($user, $group);
|
|
|
|
\OC_Group::addToGroup($user2, $group2);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user, $group);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::deleteUser(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group);
|
|
|
|
\OC_Group::deleteGroup($group2);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testDeleteOtherAsAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
|
|
|
$result = \OCA\provisioning_API\Users::deleteUser(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testDeleteSelfAsAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::deleteUser(array(
|
|
|
|
'userid' => $user,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUsersGroupsOnSelf() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user);
|
|
|
|
$group = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
|
|
|
\OC_Group::addToGroup($user, $group);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::getUsersGroups(array(
|
|
|
|
'userid' => $user,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals($group, reset($data['groups']));
|
|
|
|
$this->assertEquals(1, count($data['groups']));
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUsersGroupOnOther() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
|
|
|
\OC_Group::addToGroup($user2, $group);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::getUsersGroups(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUsersGroupOnOtherAsAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
|
|
|
\OC_Group::addToGroup($user2, $group);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::getUsersGroups(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals($group, reset($data['groups']));
|
|
|
|
$this->assertEquals(1, count($data['groups']));
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUsersGroupsOnOtherAsSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
$group2 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::createGroup($group2);
|
|
|
|
\OC_Group::addToGroup($user2, $group1);
|
|
|
|
\OC_Group::addToGroup($user2, $group2);
|
|
|
|
\OC_Group::addToGroup($user1, $group1);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::getUsersGroups(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals($group1, reset($data['groups']));
|
|
|
|
$this->assertEquals(1, count($data['groups']));
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group1);
|
|
|
|
\OC_Group::deleteGroup($group2);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetUsersGroupsOnOtherAsIrelevantSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
$group2 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::createGroup($group2);
|
|
|
|
\OC_Group::addToGroup($user2, $group2);
|
|
|
|
\OC_Group::addToGroup($user1, $group1);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_API\Users::getUsersGroups(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group1);
|
|
|
|
\OC_Group::deleteGroup($group2);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAddToGroup() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
$group = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group;
|
|
|
|
$result = \OCA\provisioning_API\Users::addToGroup(array(
|
|
|
|
'userid' => $user,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertFalse(\OC_Group::inGroup($user, $group));
|
|
|
|
\OC_Group::deleteGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAddToGroupAsAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::addToGroup($user, 'admin');
|
|
|
|
$group = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group;
|
|
|
|
$result = \OCA\provisioning_API\Users::addToGroup(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertTrue(\OC_Group::inGroup($user2, $group));
|
|
|
|
\OC_Group::deleteGroup($group);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAddToGroupAsSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group1;
|
|
|
|
$result = \OCA\provisioning_API\Users::addToGroup(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertFalse(\OC_Group::inGroup($user2, $group1));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testAddToGroupAsIrelevantSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
$group2 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::createGroup($group2);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group2;
|
|
|
|
$result = \OCA\provisioning_API\Users::addToGroup(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertFalse(\OC_Group::inGroup($user2, $group2));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
|
|
|
\OC_Group::deleteGroup($group2);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// test delete /cloud/users/{userid}/groups
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testRemoveFromGroupAsSelf() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::addToGroup($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::removeFromGroup(array(
|
|
|
|
'userid' => $user1,
|
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group1,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertTrue(\OC_Group::inGroup($user1, $group1));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testRemoveFromGroupAsAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::addToGroup($user2, $group1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::removeFromGroup(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group1,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertFalse(\OC_Group::inGroup($user2, $group1));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testRemoveFromGroupAsSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::addToGroup($user1, $group1);
|
|
|
|
\OC_Group::addToGroup($user2, $group1);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::removeFromGroup(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group1,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertFalse(\OC_Group::inGroup($user2, $group1));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testRemoveFromGroupAsIrelevantSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
$group2 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_Group::createGroup($group2);
|
|
|
|
\OC_Group::addToGroup($user1, $group1);
|
|
|
|
\OC_Group::addToGroup($user2, $group2);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user1, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::removeFromGroup(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group2,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertTrue(\OC_Group::inGroup($user2, $group2));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
|
|
|
\OC_Group::deleteGroup($group2);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testCreateSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group1;
|
|
|
|
$result = \OCA\provisioning_api\Users::addSubAdmin(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertTrue(\OC_SubAdmin::isSubAdminofGroup($user2, $group1));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
|
|
|
|
$this->resetParams();
|
|
|
|
|
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = 'admin';
|
|
|
|
$result = \OCA\provisioning_api\Users::addSubAdmin(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertEquals(103, $result->getStatusCode());
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
|
|
|
|
$this->resetParams();
|
|
|
|
|
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group1;
|
|
|
|
$result = \OCA\provisioning_api\Users::addSubAdmin(array(
|
2015-01-07 09:34:42 +00:00
|
|
|
'userid' => $this->getUniqueID(),
|
2014-12-22 13:54:50 +00:00
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
$this->assertEquals(101, $result->getStatusCode());
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testRemoveSubAdmin() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user2, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::removeSubAdmin(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group1,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
2015-01-07 09:34:42 +00:00
|
|
|
$this->assertTrue(!\OC_SubAdmin::isSubAdminofGroup($user2, $group1));
|
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
|
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::removeSubAdmin(array(
|
2015-01-07 09:34:42 +00:00
|
|
|
'userid' => $this->getUniqueID(),
|
2014-12-22 13:54:50 +00:00
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group1,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertEquals(101, $result->getStatusCode());
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
|
|
|
|
$this->resetParams();
|
|
|
|
|
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$_POST['groupid'] = $group1;
|
|
|
|
$result = \OCA\provisioning_api\Users::removeSubAdmin(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
'_delete' => array(
|
|
|
|
'groupid' => $group1,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
$this->assertEquals(102, $result->getStatusCode());
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
}
|
|
|
|
|
2015-01-07 09:34:42 +00:00
|
|
|
public function testGetSubAdminGroups() {
|
2014-12-22 13:54:50 +00:00
|
|
|
$user1 = $this->generateUsers();
|
|
|
|
$user2 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
|
|
|
$group1 = $this->getUniqueID();
|
|
|
|
\OC_Group::createGroup($group1);
|
|
|
|
\OC_SubAdmin::createSubAdmin($user2, $group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::getUserSubAdminGroups(array(
|
|
|
|
'userid' => $user2,
|
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertTrue($result->succeeded());
|
|
|
|
$data = $result->getData();
|
|
|
|
$this->assertEquals($group1, reset($data));
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_Group::deleteGroup($group1);
|
2014-12-22 13:54:50 +00:00
|
|
|
|
|
|
|
$user1 = $this->generateUsers();
|
2015-01-07 09:34:42 +00:00
|
|
|
\OC_User::setUserId($user1);
|
|
|
|
\OC_Group::addToGroup($user1, 'admin');
|
|
|
|
$group1 = $this->getUniqueID();
|
2014-12-22 13:54:50 +00:00
|
|
|
$result = \OCA\provisioning_api\Users::getUserSubAdminGroups(array(
|
2015-01-07 09:34:42 +00:00
|
|
|
'userid' => $this->getUniqueID(),
|
2014-12-22 13:54:50 +00:00
|
|
|
));
|
|
|
|
$this->assertInstanceOf('OC_OCS_Result', $result);
|
|
|
|
$this->assertFalse($result->succeeded());
|
|
|
|
$this->assertEquals(101, $result->getStatusCode());
|
|
|
|
}
|
|
|
|
}
|