Source
$this->zbxTestAssertElementText("//ul/li[2]", 'If you think this message is wrong, please consult your administrators about getting the necessary permissions.');
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../../include/CLegacyWebTest.php';
/**
* @onBefore removeGuestFromDisabledGroup, prepareUserData
*
* @backup users
*/
class testUrlUserPermissions extends CLegacyWebTest {
public function prepareUserData() {
CDataHelper::call('user.create', [
[
'username' => 'test-admin',
'passwd' => 'zabbix12345',
'roleid' => USER_TYPE_ZABBIX_ADMIN,
'usrgrps' => [['usrgrpid' => 7]] // Zabbix administrators.
]
]);
}
/**
* Guest user needs to be out of "Disabled" group to have access to frontend.
*/
public function removeGuestFromDisabledGroup() {
DBexecute('DELETE FROM users_groups WHERE userid=2 AND usrgrpid=9');
}
public function addGuestToDisabledGroup() {
DBexecute('INSERT INTO users_groups (id, usrgrpid, userid) VALUES (1552, 9, 2)');
}
public static function data() {
return [
// #0 Monitoring.
[[
'url' => 'zabbix.php?action=dashboard.view',
'title' => 'Dashboard',
'header' => 'Global view',
'users' => [
'guest' => true,
'user-zabbix' => true,
'test-admin' => true
]
]],
// #1.
[[
'url' => 'zabbix.php?action=problem.view',
'title' => 'Problems',
'header' => 'Problems',