Source
public static function setHostGroupPermissions($usergroup_name, $hostgroup_name, $permission, $subgroups = false) {
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__).'/../../../include/gettextwrapper.inc.php';
require_once dirname(__FILE__).'/../../../include/defines.inc.php';
require_once dirname(__FILE__).'/../../../conf/zabbix.conf.php';
require_once dirname(__FILE__).'/../../../include/func.inc.php';
require_once dirname(__FILE__).'/../../../include/classes/api/CApiService.php';
require_once dirname(__FILE__).'/../../../include/db.inc.php';
require_once dirname(__FILE__).'/../../../include/classes/db/DB.php';
require_once dirname(__FILE__).'/../../../include/classes/user/CWebUser.php';
require_once dirname(__FILE__).'/../../../include/classes/debug/CProfiler.php';
require_once dirname(__FILE__).'/../../../include/classes/db/DbBackend.php';
require_once dirname(__FILE__).'/../../../include/classes/db/MysqlDbBackend.php';
require_once dirname(__FILE__).'/../../../include/classes/db/PostgresqlDbBackend.php';
require_once dirname(__FILE__).'/CTestArrayHelper.php';
/**
* Database helper.
*/
class CDBHelper {
/**
* Backup stack.
*
* @var array
*/
static $backups = [];
/**
* Perform select query and check the result.
*
* @param string $sql query to be executed
* @param integer $limit data limit
* @param integer $offset data offset
*
* @return mixed
*
* @throws Exception
*/
protected static function select($sql, $limit = null, $offset = 0) {
if (($result = DBselect($sql, $limit, $offset)) === false) {
throw new Exception('Failed to execute query: "'.$sql.'".');
}
return $result;