forked from oceanbase/oceanbase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathob_user_cmd_executor.h
More file actions
133 lines (121 loc) · 4.16 KB
/
Copy pathob_user_cmd_executor.h
File metadata and controls
133 lines (121 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#ifndef OCEANBASE_SQL_ENGINE_CMD_USER_CMD_EXECUTOR_
#define OCEANBASE_SQL_ENGINE_CMD_USER_CMD_EXECUTOR_
#include "share/ob_define.h"
#include "lib/string/ob_string.h"
#include "lib/container/ob_array_serialization.h"
#include "share/schema/ob_schema_struct.h"
namespace oceanbase
{
namespace obrpc
{
class ObCommonRpcProxy;
struct ObCreateUserArg;
struct ObLockUserArg;
struct ObRenameUserArg;
struct ObDropUserArg;
}
namespace sql
{
class ObExecContext;
class ObCreateUserStmt;
class ObDropUserExecutor;
class ObCreateUserExecutor
{
public:
ObCreateUserExecutor() {}
virtual ~ObCreateUserExecutor() {}
int execute(ObExecContext &ctx, ObCreateUserStmt &stmt);
static int encrypt_passwd(const common::ObString& passwd,
common::ObString& encrypted_passwd,
char *enc_buf,
int64_t buf_len);
static int userinfo_extract_user_name(
const common::ObIArray<share::schema::ObUserInfo> &user_infos,
const common::ObIArray<int64_t> &index,
common::ObIArray<common::ObString> &users,
common::ObIArray<common::ObString> &hosts);
private:
int create_user(obrpc::ObCommonRpcProxy *rpc_proxy,
const obrpc::ObCreateUserArg &arg) const;
private:
DISALLOW_COPY_AND_ASSIGN(ObCreateUserExecutor);
};
class ObDropUserStmt;
class ObDropUserExecutor
{
public:
ObDropUserExecutor() {}
virtual ~ObDropUserExecutor() {}
static int build_fail_msg(const common::ObIArray<common::ObString> &users,
const common::ObIArray<common::ObString> &hosts,
common::ObSqlString &msg);
static int string_array_index_extract(const common::ObIArray<common::ObString> &src_users,
const common::ObIArray<common::ObString> &src_hosts,
const common::ObIArray<int64_t> &index,
common::ObIArray<common::ObString> &dst_users,
common::ObIArray<common::ObString> &dst_hosts);
int execute(ObExecContext &ctx, ObDropUserStmt &stmt);
private:
int drop_user(obrpc::ObCommonRpcProxy *rpc_proxy,
const obrpc::ObDropUserArg &arg);
DISALLOW_COPY_AND_ASSIGN(ObDropUserExecutor);
};
class ObLockUserStmt;
class ObLockUserExecutor
{
public:
ObLockUserExecutor() {}
virtual ~ObLockUserExecutor() {}
int execute(ObExecContext &ctx, ObLockUserStmt &stmt);
private:
int lock_user(obrpc::ObCommonRpcProxy *rpc_proxy,
const obrpc::ObLockUserArg &arg);
DISALLOW_COPY_AND_ASSIGN(ObLockUserExecutor);
};
class ObAlterUserProfileStmt;
class ObAlterUserProfileExecutor
{
private:
int set_role_exec(ObExecContext &ctx, ObAlterUserProfileStmt &stmt);
public:
ObAlterUserProfileExecutor() {}
virtual ~ObAlterUserProfileExecutor() {}
int execute(ObExecContext &ctx, ObAlterUserProfileStmt &stmt);
DISALLOW_COPY_AND_ASSIGN(ObAlterUserProfileExecutor);
};
class ObRenameUserStmt;
class ObRenameUserExecutor
{
public:
ObRenameUserExecutor() {}
virtual ~ObRenameUserExecutor() {}
int execute(ObExecContext &ctx, ObRenameUserStmt &stmt);
private:
int rename_user(obrpc::ObCommonRpcProxy *rpc_proxy,
const obrpc::ObRenameUserArg &arg);
DISALLOW_COPY_AND_ASSIGN(ObRenameUserExecutor);
};
class ObAlterUserPrimaryZoneStmt;
class ObAlterUserPrimaryZoneExecutor
{
public:
ObAlterUserPrimaryZoneExecutor() {}
virtual ~ObAlterUserPrimaryZoneExecutor() {}
int execute(ObExecContext &ctx, ObAlterUserPrimaryZoneStmt &stmt);
private:
DISALLOW_COPY_AND_ASSIGN(ObAlterUserPrimaryZoneExecutor);
};
}
}
#endif //OCEANBASE_SQL_ENGINE_CMD_USER_CMD_EXECUTOR_