Manage PostgreSQL User Permissions – Multiple Databases and Users

database-designpermissionspostgresqlusers

How do you manage users' permissions efficiently when your company has a lot of databases and users?

My company has > 20 reporting databases. Whenever I need to change permission for some users, I need to use psql \dp and fire some queries to alter their roles.

It's ok for now since we only have 5 users, but surely the number would increase and make it very hard to manage it properly via the terminal. Could you suggest me some ways (or tools) to efficiently manage database permissions?

Best Answer

You use roles that have privileges on the objects.

The end users have no privileges assigned, but are members of those roles whose privileges they should inherit.

Then you can simply drop end users, and adding them just means adding them to a couple of roles.