Permissions for DB
DB
- Role
- Kinds of permissions for DB
- Setting/Deleting permissions
Role
- Super user ** Has a mighty permission ** Creates general roles and their permissions
Creation/Deletion of a role
CREATE ROLE|USER role [[WITH] attribute [...]];
ALTER ROLE role [[WITH] attribute [...]];
DROP ROLE|USER role [...];
Main attributes:
* LOGIN/NOLOGIN
* SUPERUSER/NOSUPERUSER
* CREATEDB/NOCREATEDB
* CREATEROLE/NOCREATEROLE
* [ENCRYPTED] PASSWORD ‘password.’
Granting/Revoking permissions
GRANT permission ON object TO user;
REVOKE permission ON object FROM user;
Examples
GRANT CONNECT ON DATABASE db00 TO dbtrainee;
REVOKE DELETE ON product FROM dbtrainee;