TDengine/source/dnode/mnode/impl/inc/mndPrivilege.h

78 lines
2.2 KiB
C
Raw Normal View History

2021-09-22 08:15:20 +00:00
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* 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.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2022-06-25 01:09:33 +00:00
#ifndef _TD_MND_PRIVILEGE_H
#define _TD_MND_PRIVILEGE_H
2021-10-04 09:44:39 +00:00
2021-11-27 14:56:18 +00:00
#include "mndInt.h"
2021-10-04 09:44:39 +00:00
2021-10-16 07:16:05 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2021-10-04 09:44:39 +00:00
typedef enum {
2022-06-24 07:55:31 +00:00
MND_OPER_CONNECT = 1,
2022-06-25 01:09:33 +00:00
MND_OPER_CREATE_ACCT,
MND_OPER_DROP_ACCT,
MND_OPER_ALTER_ACCT,
2022-06-24 07:55:31 +00:00
MND_OPER_CREATE_USER,
MND_OPER_DROP_USER,
MND_OPER_ALTER_USER,
MND_OPER_CREATE_BNODE,
MND_OPER_DROP_BNODE,
MND_OPER_CREATE_DNODE,
MND_OPER_DROP_DNODE,
2022-06-25 00:56:47 +00:00
MND_OPER_CONFIG_DNODE,
MND_OPER_CREATE_MNODE,
MND_OPER_DROP_MNODE,
MND_OPER_CREATE_QNODE,
MND_OPER_DROP_QNODE,
MND_OPER_CREATE_SNODE,
MND_OPER_DROP_SNODE,
MND_OPER_REDISTRIBUTE_VGROUP,
2022-06-25 00:56:47 +00:00
MND_OPER_MERGE_VGROUP,
MND_OPER_SPLIT_VGROUP,
MND_OPER_BALANCE_VGROUP,
MND_OPER_CREATE_FUNC,
MND_OPER_DROP_FUNC,
MND_OPER_KILL_TRANS,
2022-06-25 01:09:33 +00:00
MND_OPER_KILL_CONN,
MND_OPER_KILL_QUERY,
MND_OPER_CREATE_DB,
MND_OPER_ALTER_DB,
MND_OPER_DROP_DB,
MND_OPER_COMPACT_DB,
MND_OPER_USE_DB,
MND_OPER_WRITE_DB,
MND_OPER_READ_DB,
2022-06-25 10:03:12 +00:00
MND_OPER_READ_OR_WRITE_DB,
MND_OPER_SHOW_VARIBALES,
} EOperType;
2022-06-25 01:09:33 +00:00
int32_t mndInitPrivilege(SMnode *pMnode);
void mndCleanupPrivilege(SMnode *pMnode);
2021-10-17 03:42:05 +00:00
2022-06-25 01:09:33 +00:00
int32_t mndCheckOperPrivilege(SMnode *pMnode, const char *user, EOperType operType);
int32_t mndCheckDbPrivilege(SMnode *pMnode, const char *user, EOperType operType, SDbObj *pDb);
2022-06-25 10:03:12 +00:00
int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *dbname);
int32_t mndCheckShowPrivilege(SMnode *pMnode, const char *user, EShowType showType, const char *dbname);
2022-06-25 01:09:33 +00:00
int32_t mndCheckAlterUserPrivilege(SUserObj *pOperUser, SUserObj *pUser, SAlterUserReq *pAlter);
2022-02-15 09:24:34 +00:00
2021-10-16 07:16:05 +00:00
#ifdef __cplusplus
}
#endif
2021-10-04 09:44:39 +00:00
2022-06-25 01:09:33 +00:00
#endif /*_TD_MND_PRIVILEGE_H*/