mirror of
https://github.com/postgres/postgres.git
synced 2026-04-12 04:26:44 -04:00
Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as user specifiers in place of an explicit user name. This commit also fixes some quite ugly handling of special standards- mandated syntax in CREATE USER MAPPING, which in particular would fail to work in presence of a role named "current_user". The special role specifiers PUBLIC and NONE also have more consistent handling now. Also take the opportunity to add location tracking to user specifiers. Authors: Kyotaro Horiguchi. Heavily reworked by Álvaro Herrera. Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.
36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* user.h
|
|
* Commands for manipulating roles (formerly called users).
|
|
*
|
|
*
|
|
* src/include/commands/user.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef USER_H
|
|
#define USER_H
|
|
|
|
#include "catalog/objectaddress.h"
|
|
#include "nodes/parsenodes.h"
|
|
|
|
|
|
/* Hook to check passwords in CreateRole() and AlterRole() */
|
|
#define PASSWORD_TYPE_PLAINTEXT 0
|
|
#define PASSWORD_TYPE_MD5 1
|
|
|
|
typedef void (*check_password_hook_type) (const char *username, const char *password, int password_type, Datum validuntil_time, bool validuntil_null);
|
|
|
|
extern PGDLLIMPORT check_password_hook_type check_password_hook;
|
|
|
|
extern Oid CreateRole(CreateRoleStmt *stmt);
|
|
extern Oid AlterRole(AlterRoleStmt *stmt);
|
|
extern Oid AlterRoleSet(AlterRoleSetStmt *stmt);
|
|
extern void DropRole(DropRoleStmt *stmt);
|
|
extern void GrantRole(GrantRoleStmt *stmt);
|
|
extern ObjectAddress RenameRole(const char *oldname, const char *newname);
|
|
extern void DropOwnedObjects(DropOwnedStmt *stmt);
|
|
extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt);
|
|
extern List *roleSpecsToIds(List *memberNames);
|
|
|
|
#endif /* USER_H */
|