How to revoke/grant to specific database?

Matheus Fernandes <[email protected]> Tue, 5 Apr 2011 17:54:06 -0300
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
--===============8899941574583956357==
Content-Type: multipart/alternative; boundary=0015175cd05ce5de4304a0321463

--0015175cd05ce5de4304a0321463
Content-Type: text/plain; charset=ISO-8859-1

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

--0015175cd05ce5de4304a0321463
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

My postgres server has at least 10 databases/users. I want to forbid table =
creation/access from users who aren&#39;t the owner of the database.<br>I a=
ctually do know a way to set this by using the psql &#39;interface&#39; and=
 the phppgadmin, but I can&#39;t make it work with pypgsql!!<br>

<br>What I do with psql is this:<br>I log in with postgres user (the superu=
ser), and use the &#39;\c database-i-want-to-configure&#39; command. When i=
&#39;m connected to the database, I run the following commands:<br><pre>

revoke create, usage on schema public from public;<br>grant create, usage o=
n schema public to user-from-connected-database;<br><br></pre>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&#39;s w=
hat I want to do on pypgsql.<br>

<br>What I&#39;ve tried:<br>On pypgsql I connect with the database I want t=
o set the privileges, run the commands above, and it run well, but makes no=
 change...<br>And just to make sure i&#39;m connected with the database, I =
used the select current_database() function and it returns the right db.<br=
>

<br>Is there any other way to make this happen?<br><br>Thanks,<br><br>Mathe=
us<br>

--0015175cd05ce5de4304a0321463--


--===============8899941574583956357==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
--===============8899941574583956357==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Pypgsql-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pypgsql-users

--===============8899941574583956357==--