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
16extern char * sql_grant_global_privs( mvc *sql, char *grantee, int privs, int grant, sqlid grantor);
17extern char * sql_revoke_global_privs( mvc *sql, char *grantee, int privs, int grant, sqlid grantor);
18extern char * sql_grant_table_privs( mvc *sql, char *grantee, int privs, char *sname, char *tname, char *cname, int grant, sqlid grantor);
19extern char * sql_revoke_table_privs( mvc *sql, char *grantee, int privs, char *sname, char *tname, char *cname, int grant, sqlid grantor);
20extern char * sql_grant_func_privs( mvc *sql, char *grantee, int privs, char *sname, sqlid func_id, int grant, sqlid grantor);
21extern char * sql_revoke_func_privs( mvc *sql, char *grantee, int privs, char *sname, sqlid func_id, int grant, sqlid grantor);
22
23extern int mvc_set_role(mvc *m, char *role);
24extern int mvc_set_schema(mvc *m, char *schema);
25
26extern int global_privs(mvc *m, int privs);
27extern int mvc_schema_privs(mvc *m, sql_schema *t);
28extern int table_privs(mvc *m, sql_table *t, int privs);
29extern int column_privs(mvc *m, sql_column *c, int privs);
30extern int execute_priv(mvc *m, sql_func *f);
31
32extern int sql_privilege(mvc *m, sqlid auth_id, sqlid obj_id, int privs, int sub);
33extern int sql_grantable(mvc *m, sqlid grantorid, sqlid obj_id, int privs, int sub);
34extern sqlid sql_find_auth(mvc *m, str auth);
35extern sqlid sql_find_schema(mvc *m, str schema);
36
37extern char *sql_create_role(mvc *m, str auth, int grantor);
38extern char *sql_drop_role(mvc *m, str auth);
39extern char *sql_grant_role(mvc *m, str grantee, str auth, sqlid grantor, int admin);
40extern char *sql_revoke_role(mvc *m, str grantee, str auth, sqlid grantor, int admin);
41extern int sql_create_privileges(mvc *m, sql_schema *s);
42extern int sql_schema_has_user(mvc *m, sql_schema *s);
43
44extern char * sql_create_user(mvc *sql, char *user, char *passwd, char enc, char *fullname, char *schema);
45extern char * sql_drop_user(mvc *sql, char *user);
46extern char * sql_alter_user(mvc *sql, char *user, char *passwd, char enc, char *schema, char *oldpasswd);
47extern char * sql_rename_user(mvc *sql, char *olduser, char *newuser);
48
49#endif /*_SQL_PRIV_H_ */
50