From: Matheus F. <mat...@gm...> - 2011-04-05 20:54:33
|
My postgres server has at least 10 databases/users. I want to forbid table creation/access from users who aren't the owner of the database. I actually do know a way to set this by using the psql 'interface' and the phppgadmin, but I can't make it work with pypgsql!! What I do with psql is this: I log in with postgres user (the superuser), and use the '\c database-i-want-to-configure' command. When i'm connected to the database, I run the following commands: revoke create, usage on schema public from public; grant create, usage on schema public to user-from-connected-database; By doing this, no one can visualize/create/drop tables from any database, except if the database was set to the user, on the above grant command.. and that's what I want to do on pypgsql. What I've tried: On pypgsql I connect with the database I want to set the privileges, run the commands above, and it run well, but makes no change... And just to make sure i'm connected with the database, I used the select current_database() function and it returns the right db. Is there any other way to make this happen? Thanks, Matheus |