Source
int zbx_check_user_administration_actions_permissions(const zbx_user_t *user, const char *role_rule_default,
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
/* group statuses */
typedef enum
{
GROUP_STATUS_ACTIVE = 0,
GROUP_STATUS_DISABLED
}
zbx_group_status_type_t;
/******************************************************************************
* *
* Purpose: Check user permissions to access system *
* *
* Parameters: userid - user ID *
* *
* Return value: SUCCEED - access allowed, FAIL - otherwise *
* *
******************************************************************************/
int check_perm2system(zbx_uint64_t userid)
{
DB_RESULT result;
DB_ROW row;
int res = SUCCEED;
result = zbx_db_select(
"select count(*)"
" from usrgrp g,users_groups ug"
" where ug.userid=" ZBX_FS_UI64
" and g.usrgrpid=ug.usrgrpid"
" and g.users_status=%d",
userid, GROUP_STATUS_DISABLED);
if (NULL != (row = zbx_db_fetch(result)) && SUCCEED != zbx_db_is_null(row[0]) && atoi(row[0]) > 0)
res = FAIL;
zbx_db_free_result(result);
return res;
}