1 | /* |
2 | * This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | * |
6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
7 | */ |
8 | |
9 | #ifndef _SQL_PRIV_H_ |
10 | #define _SQL_PRIV_H_ |
11 | |
12 | /* privileges */ |
13 | #include "sql_mvc.h" |
14 | #include "sql_catalog.h" |
15 | |
16 | extern char * sql_grant_global_privs( mvc *sql, char *grantee, int privs, int grant, sqlid grantor); |
17 | extern char * sql_revoke_global_privs( mvc *sql, char *grantee, int privs, int grant, sqlid grantor); |
18 | extern char * sql_grant_table_privs( mvc *sql, char *grantee, int privs, char *sname, char *tname, char *cname, int grant, sqlid grantor); |
19 | extern char * sql_revoke_table_privs( mvc *sql, char *grantee, int privs, char *sname, char *tname, char *cname, int grant, sqlid grantor); |
20 | extern char * sql_grant_func_privs( mvc *sql, char *grantee, int privs, char *sname, sqlid func_id, int grant, sqlid grantor); |
21 | extern char * sql_revoke_func_privs( mvc *sql, char *grantee, int privs, char *sname, sqlid func_id, int grant, sqlid grantor); |
22 | |
23 | extern int mvc_set_role(mvc *m, char *role); |
24 | extern int mvc_set_schema(mvc *m, char *schema); |
25 | |
26 | extern int global_privs(mvc *m, int privs); |
27 | extern int mvc_schema_privs(mvc *m, sql_schema *t); |
28 | extern int table_privs(mvc *m, sql_table *t, int privs); |
29 | extern int column_privs(mvc *m, sql_column *c, int privs); |
30 | extern int execute_priv(mvc *m, sql_func *f); |
31 | |
32 | extern int sql_privilege(mvc *m, sqlid auth_id, sqlid obj_id, int privs, int sub); |
33 | extern int sql_grantable(mvc *m, sqlid grantorid, sqlid obj_id, int privs, int sub); |
34 | extern sqlid sql_find_auth(mvc *m, str auth); |
35 | extern sqlid sql_find_schema(mvc *m, str schema); |
36 | |
37 | extern char *sql_create_role(mvc *m, str auth, int grantor); |
38 | extern char *sql_drop_role(mvc *m, str auth); |
39 | extern char *sql_grant_role(mvc *m, str grantee, str auth, sqlid grantor, int admin); |
40 | extern char *sql_revoke_role(mvc *m, str grantee, str auth, sqlid grantor, int admin); |
41 | extern int sql_create_privileges(mvc *m, sql_schema *s); |
42 | extern int sql_schema_has_user(mvc *m, sql_schema *s); |
43 | |
44 | extern char * sql_create_user(mvc *sql, char *user, char *passwd, char enc, char *fullname, char *schema); |
45 | extern char * sql_drop_user(mvc *sql, char *user); |
46 | extern char * sql_alter_user(mvc *sql, char *user, char *passwd, char enc, char *schema, char *oldpasswd); |
47 | extern char * sql_rename_user(mvc *sql, char *olduser, char *newuser); |
48 | |
49 | #endif /*_SQL_PRIV_H_ */ |
50 | |