本文整理汇总了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']);
}