Source
'&ui_configuration_internal_actions=1&ui_administration_media_types=0&ui_administration_scripts=0&ui_administration_user_groups=0'.
<?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/CWebTest.php';
require_once dirname(__FILE__).'/../behaviors/CMessageBehavior.php';
/**
* @backup token, connector
*
* @dataSource ScheduledReports, Proxies, Services, Sla
*
* @onBefore prepareData
*/
class testPermissionsWithoutCSRF extends CWebTest {
const INCORRECT_REQUEST = [
'message' => 'Zabbix has received an incorrect request.',
'details' => 'Operation cannot be performed due to unauthorized request.'
];
const ACCESS_DENIED = [
'message' => 'Access denied',
'details' => 'You are logged in as "Admin". You have no permissions to access this page.'
];
/**
* Attach MessageBehavior to the test.
*
* @return array
*/
public function getBehaviors() {
return [CMessageBehavior::class];
}
public function prepareData() {
$tokens = CDataHelper::call('token.create', [
'name' => 'api_token_update',
'userid' => '1'
]);
$this->assertArrayHasKey('tokenids', $tokens);
$connectors = CDataHelper::call('connector.create', [
'name' => 'test_token_connector',
'url' => 'http://test.url'
]);
$this->assertArrayHasKey('connectorids', $connectors);
// Create event correlation.
CDataHelper::call('correlation.create', [
[