pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedUser Privileges
12+ messages / 10 participants
[nested] [flat]
* User Privileges
@ 2000-12-26 16:55 Niral Trivedi <niral.trivedi@insage.com>
0 siblings, 1 reply; 12+ messages in thread
From: Niral Trivedi @ 2000-12-26 16:55 UTC (permalink / raw)
To: pgsql-general
All,
How can you grant privileges to a user to all tables in database?
For example I have 5 tables in database A. And now I want to give
SELECT/UPDATE/INSERT privileges to a user to all 5 tables. But according to
documentation, I have to execute 'GRANT' query 3 times(for
select/update/insert) per table. meaning total of 15 times!!!!
Is there any way I can do that in just one shot?
Basically I want to give user privileges to all tables in databse at once.
Like we can do in MySQL by adding a user in 'db' and 'user' table.
Is it possible in PostgreSQL? How?
Thanks in advance..
Niral
^ permalink raw reply [nested|flat] 12+ messages in thread
* RE: User Privileges
@ 2000-12-26 17:36 Niral Trivedi <niral.trivedi@insage.com>
0 siblings, 0 replies; 12+ messages in thread
From: Niral Trivedi @ 2000-12-26 17:36 UTC (permalink / raw)
To: 'Dan Wilson' <phpPgAdmin@acucore.com>; pgsql-general
Thank you..
Niral
-----Original Message-----
From: Dan Wilson [mailto:phpPgAdmin@acucore.com]
Sent: Tuesday, December 26, 2000 1:25 PM
To: Niral Trivedi; pgsql-general@postgresql.org
Subject: Re: [GENERAL] User Privileges
> For example I have 5 tables in database A. And now I want to give
> SELECT/UPDATE/INSERT privileges to a user to all 5 tables. But according
to
> documentation, I have to execute 'GRANT' query 3 times(for
> select/update/insert) per table. meaning total of 15 times!!!!
That's incorrect... you can do it all in one statement:
GRANT select,update,insert TO "<username>" ON table_1,table_2,table_3,etc
http://www.postgresql.org/users-lounge/docs/7.0/user/sql-grant.htm
-Dan
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: User Privileges
@ 2000-12-26 18:25 Dan Wilson <phpPgAdmin@acucore.com>
parent: Niral Trivedi <niral.trivedi@insage.com>
0 siblings, 1 reply; 12+ messages in thread
From: Dan Wilson @ 2000-12-26 18:25 UTC (permalink / raw)
To: Niral Trivedi <niral.trivedi@insage.com>; pgsql-general
> For example I have 5 tables in database A. And now I want to give
> SELECT/UPDATE/INSERT privileges to a user to all 5 tables. But according
to
> documentation, I have to execute 'GRANT' query 3 times(for
> select/update/insert) per table. meaning total of 15 times!!!!
That's incorrect... you can do it all in one statement:
GRANT select,update,insert TO "<username>" ON table_1,table_2,table_3,etc
http://www.postgresql.org/users-lounge/docs/7.0/user/sql-grant.htm
-Dan
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: User Privileges
@ 2000-12-27 07:57 W. van den Akker <wvdakker@wilsoft.nl>
parent: Dan Wilson <phpPgAdmin@acucore.com>
0 siblings, 2 replies; 12+ messages in thread
From: W. van den Akker @ 2000-12-27 07:57 UTC (permalink / raw)
To: pgsql-general
How do I retrieve this privilages?
I want to disable menu-options within a program. For that I have to
retrieve the privilages for some tables.
gr,
Willem
----- Original Message -----
From: "Dan Wilson" <phpPgAdmin@acucore.com>
To: "Niral Trivedi" <niral.trivedi@insage.com>;
<pgsql-general@postgresql.org>
Sent: Tuesday, December 26, 2000 7:25 PM
Subject: Re: [GENERAL] User Privileges
> > For example I have 5 tables in database A. And now I want to give
> > SELECT/UPDATE/INSERT privileges to a user to all 5 tables. But according
> to
> > documentation, I have to execute 'GRANT' query 3 times(for
> > select/update/insert) per table. meaning total of 15 times!!!!
>
> That's incorrect... you can do it all in one statement:
>
> GRANT select,update,insert TO "<username>" ON table_1,table_2,table_3,etc
>
> http://www.postgresql.org/users-lounge/docs/7.0/user/sql-grant.htm
>
> -Dan
>
>
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: User Privileges
@ 2000-12-28 09:33 Jens Hartwig <jhartwig@debis.com>
parent: W. van den Akker <wvdakker@wilsoft.nl>
1 sibling, 0 replies; 12+ messages in thread
From: Jens Hartwig @ 2000-12-28 09:33 UTC (permalink / raw)
To: W. van den Akker <wvdakker@wilsoft.nl>; +Cc: pgsql-general
Hello,
the information can be found in the system-table-column PG_CLASS.RELACL:
SELECT RELACL
FROM PG_CLASS
WHERE RELNAME = 't_dummy';
The result seems to be an array of granted permissions, so you should
treat it is an array and look for the appropriate user- or group-name.
Hope this helps ...
Regards, Jens
"W. van den Akker" schrieb:
>
> How do I retrieve this privilages?
> I want to disable menu-options within a program. For that I have to
> retrieve the privilages for some tables.
>
> gr,
>
> Willem
>
> ----- Original Message -----
> From: "Dan Wilson" <phpPgAdmin@acucore.com>
> To: "Niral Trivedi" <niral.trivedi@insage.com>;
> <pgsql-general@postgresql.org>
> Sent: Tuesday, December 26, 2000 7:25 PM
> Subject: Re: [GENERAL] User Privileges
>
> > > For example I have 5 tables in database A. And now I want to give
> > > SELECT/UPDATE/INSERT privileges to a user to all 5 tables. But according
> > to
> > > documentation, I have to execute 'GRANT' query 3 times(for
> > > select/update/insert) per table. meaning total of 15 times!!!!
> >
> > That's incorrect... you can do it all in one statement:
> >
> > GRANT select,update,insert TO "<username>" ON table_1,table_2,table_3,etc
> >
> > http://www.postgresql.org/users-lounge/docs/7.0/user/sql-grant.htm
> >
> > -Dan
> >
> >
> >
=============================================
Jens Hartwig
---------------------------------------------
debis Systemhaus GEI mbH
10875 Berlin
Tel. : +49 (0)30 2554-3282
Fax : +49 (0)30 2554-3187
Mobil : +49 (0)170 167-2648
E-Mail : jhartwig@debis.com
=============================================
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: User Privileges
@ 2000-12-28 09:42 Dan Wilson <phpPgAdmin@acucore.com>
parent: W. van den Akker <wvdakker@wilsoft.nl>
1 sibling, 0 replies; 12+ messages in thread
From: Dan Wilson @ 2000-12-28 09:42 UTC (permalink / raw)
To: W. van den Akker <wvdakker@wilsoft.nl>; pgsql-general
SELECT relacl FROM pg_class WHERE relname = '[table name]'
The relacl column contains specific information that must then be parsed to
determine the users which have access to a the table and the privileges
granted.
Example:
{"=","dan=arw","group developers=arw"}
The first section means the PUBLIC does not have any privileges on the
table. Each permission (SELECT, INSERT, UPDATE/DELETE, RULE) is signified
by a letter. r = select, a = insert, w = update/delete, R = rule. User
"dan" has SELECT, INSERT, UPDATE/DELETE rights, but not RULE rights. Group
"developers" has the same privileges.
For more details --
http://www.postgresql.org/users-lounge/docs/7.0/user/sql-grant.htm
-Dan
----- Original Message -----
From: "W. van den Akker" <wvdakker@wilsoft.nl>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, December 26, 2000 11:57 PM
Subject: Re: [GENERAL] User Privileges
> How do I retrieve this privilages?
> I want to disable menu-options within a program. For that I have to
> retrieve the privilages for some tables.
>
> gr,
>
> Willem
>
> ----- Original Message -----
> From: "Dan Wilson" <phpPgAdmin@acucore.com>
> To: "Niral Trivedi" <niral.trivedi@insage.com>;
> <pgsql-general@postgresql.org>
> Sent: Tuesday, December 26, 2000 7:25 PM
> Subject: Re: [GENERAL] User Privileges
>
>
> > > For example I have 5 tables in database A. And now I want to give
> > > SELECT/UPDATE/INSERT privileges to a user to all 5 tables. But
according
> > to
> > > documentation, I have to execute 'GRANT' query 3 times(for
> > > select/update/insert) per table. meaning total of 15 times!!!!
> >
> > That's incorrect... you can do it all in one statement:
> >
> > GRANT select,update,insert TO "<username>" ON
table_1,table_2,table_3,etc
> >
> > http://www.postgresql.org/users-lounge/docs/7.0/user/sql-grant.htm
> >
> > -Dan
> >
> >
> >
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* User privileges
@ 2001-10-16 17:26 Mihai Gheorghiu <tanethq@earthlink.net>
0 siblings, 1 reply; 12+ messages in thread
From: Mihai Gheorghiu @ 2001-10-16 17:26 UTC (permalink / raw)
To: pgsql-general
It is possible that a user is a member of more than one group.
Do this user's privileges AND or OR the privileges of each of the two
groups?
Thank you all.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: User privileges
@ 2001-10-17 03:17 Tom Lane <tgl@sss.pgh.pa.us>
parent: Mihai Gheorghiu <tanethq@earthlink.net>
0 siblings, 0 replies; 12+ messages in thread
From: Tom Lane @ 2001-10-17 03:17 UTC (permalink / raw)
To: Mihai Gheorghiu <tanethq@earthlink.net>; +Cc: pgsql-general
"Mihai Gheorghiu" <tanethq@earthlink.net> writes:
> It is possible that a user is a member of more than one group.
> Do this user's privileges AND or OR the privileges of each of the two
> groups?
OR. A user's privileges are always the union of what he has personally
and what he has via any group. See aclcheck() in
src/backend/catalog/aclchk.c: it keeps looking for any way to grant
permission.
regards, tom lane
^ permalink raw reply [nested|flat] 12+ messages in thread
* User privileges
@ 2002-04-24 13:20 M.L.Bowman <M.L.Bowman@ukc.ac.uk>
0 siblings, 0 replies; 12+ messages in thread
From: M.L.Bowman @ 2002-04-24 13:20 UTC (permalink / raw)
To: pgsql-general; +Cc: M.L.Bowman@ukc.ac.uk
Hello,
I have created a database (testdb) and given users trusted access to it
from a single machine.
host testdb xxx.xxx.xxx.xxx 255.255.225.225 trust
xxx.xxx.xxx.xxx is substituted with the real IP address
A user does not have, by default, any access to tables and is dependent
upon the database owner to grant them. The database owner has created
tables and granted various access permissions to users for those
tables. This all works as expected.
What I didn't anticipate was that users , by default, would be able to create
tables within this database and grant access permissions on them.
I do not want this functionality and need to switch it off somehow.
I have looked for ways to do this within the sql commands CREATE DATABASE
and GRANT, but cannot find anything.
1. How can I deny users the ability to create tables within a database
yet still allow them access to existing tables created by the
database owner ?
Your help would be most appreciated.
Many Thanks
Maggie
^ permalink raw reply [nested|flat] 12+ messages in thread
* user privileges
@ 2021-06-21 10:40 Atul Kumar <akumar14871@gmail.com>
0 siblings, 2 replies; 12+ messages in thread
From: Atul Kumar @ 2021-06-21 10:40 UTC (permalink / raw)
To: pgsql-general <pgsql-general@lists.postgresql.org>
Hi,
My question can be silly but I need to ask that if a user is created
without login privilege then what is the use of below command why
don't postgres prompt error on it
CREATE ROLE nolog_user WITH PASSWORD 'pass1';
as the user is created with login privileges then what is the use such user ?
Where such users having no login privileges can be used ?
Regards.
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: user privileges
@ 2021-06-21 12:30 Charles Clavadetscher <clavadetscher@swisspug.org>
parent: Atul Kumar <akumar14871@gmail.com>
1 sibling, 0 replies; 12+ messages in thread
From: Charles Clavadetscher @ 2021-06-21 12:30 UTC (permalink / raw)
To: Atul Kumar <akumar14871@gmail.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Hello
On 2021-06-21 12:40, Atul Kumar wrote:
> Hi,
>
> My question can be silly but I need to ask that if a user is created
> without login privilege then what is the use of below command why
> don't postgres prompt error on it
>
> CREATE ROLE nolog_user WITH PASSWORD 'pass1';
A user without login privilege is usally called a group and is used for
bundling privileges that you can grant granting the role to individual
users. This helps you to keep more order and structure in your DB
privileges.
You may also have a user that can login and for whatever reason must be
restricted access for a certain time.
> as the user is created with login privileges then what is the use such
> user ?
See above.
> Where such users having no login privileges can be used ?
Yes, you use it as a group.
--
Charles Clavadetscher
Spitzackerstrasse 9
CH - 8057 Zürich
https://www.swisspug.org
+------------------------+
| ____ ______ ___ |
| / )/ \/ \ |
| ( / __ _\ ) |
| \ (/ o) ( o) ) |
| \_ (_ ) \ ) _/ |
| \ /\_/ \)/ |
| \/ <//| |\\> |
| _| | |
| \|_/ |
| |
| Swiss PostgreSQL |
| Users Group |
+------------------------+
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: user privileges
@ 2021-06-21 14:27 Laurenz Albe <laurenz.albe@cybertec.at>
parent: Atul Kumar <akumar14871@gmail.com>
1 sibling, 0 replies; 12+ messages in thread
From: Laurenz Albe @ 2021-06-21 14:27 UTC (permalink / raw)
To: Atul Kumar <akumar14871@gmail.com>; pgsql-general <pgsql-general@lists.postgresql.org>
On Mon, 2021-06-21 at 16:10 +0530, Atul Kumar wrote:
> My question can be silly but I need to ask that if a user is created
> without login privilege then what is the use of below command why
> don't postgres prompt error on it
>
> CREATE ROLE nolog_user WITH PASSWORD 'pass1';
>
> as the user is created with login privileges then what is the use such user ?
The role can be the owner of objects, or it can have members that
inherit privileges.
But setting a password is pointless on a role that cannot login.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2021-06-21 14:27 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-12-26 16:55 User Privileges Niral Trivedi <niral.trivedi@insage.com>
2000-12-26 18:25 ` Dan Wilson <phpPgAdmin@acucore.com>
2000-12-27 07:57 ` W. van den Akker <wvdakker@wilsoft.nl>
2000-12-28 09:33 ` Jens Hartwig <jhartwig@debis.com>
2000-12-28 09:42 ` Dan Wilson <phpPgAdmin@acucore.com>
2000-12-26 17:36 RE: User Privileges Niral Trivedi <niral.trivedi@insage.com>
2001-10-16 17:26 User privileges Mihai Gheorghiu <tanethq@earthlink.net>
2001-10-17 03:17 ` Re: User privileges Tom Lane <tgl@sss.pgh.pa.us>
2002-04-24 13:20 User privileges M.L.Bowman <M.L.Bowman@ukc.ac.uk>
2021-06-21 10:40 user privileges Atul Kumar <akumar14871@gmail.com>
2021-06-21 12:30 ` Re: user privileges Charles Clavadetscher <clavadetscher@swisspug.org>
2021-06-21 14:27 ` Re: user privileges Laurenz Albe <laurenz.albe@cybertec.at>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox