本文整理匯總了PHP中Piwik\Plugins\UsersManager\API::getUsers方法的典型用法代碼示例。如果您正苦於以下問題:PHP API::getUsers方法的具體用法?PHP API::getUsers怎麽用?PHP API::getUsers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Piwik\Plugins\UsersManager\API
的用法示例。
在下文中一共展示了API::getUsers方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSetSuperUserAccess_ShouldAddAndRemoveSuperUserAccessOnlyForGivenLogin
public function testSetSuperUserAccess_ShouldAddAndRemoveSuperUserAccessOnlyForGivenLogin()
{
$this->api->addUser('login1', 'password1', 'test1@example.com', false);
$this->api->addUser('login2', 'password2', 'test2@example.com', false);
$this->api->addUser('login3', 'password3', 'test3@example.com', false);
$this->api->setSuperUserAccess('login2', true);
// test add Super User access
$users = $this->api->getUsers();
$this->assertEquals(0, $users[0]['superuser_access']);
$this->assertEquals(1, $users[1]['superuser_access']);
$this->assertEquals('login2', $users[1]['login']);
$this->assertEquals(0, $users[2]['superuser_access']);
// should also accept string '1' to add Super User access
$this->api->setSuperUserAccess('login1', '1');
// test remove Super User access
$this->api->setSuperUserAccess('login2', false);
$users = $this->api->getUsers();
$this->assertEquals(1, $users[0]['superuser_access']);
$this->assertEquals('login1', $users[0]['login']);
$this->assertEquals(0, $users[1]['superuser_access']);
$this->assertEquals(0, $users[2]['superuser_access']);
$this->api->setSuperUserAccess('login3', true);
// should also accept string '0' to remove Super User access
$this->api->setSuperUserAccess('login1', '0');
$users = $this->api->getUsers();
$this->assertEquals(0, $users[0]['superuser_access']);
$this->assertEquals(0, $users[1]['superuser_access']);
$this->assertEquals('login3', $users[2]['login']);
$this->assertEquals(1, $users[2]['superuser_access']);
}