pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
is a user in a group?
4+ messages / 3 participants
[nested] [flat]

* is a user in a group?
@ 2000-11-10 14:28  Jacopo Silva <jsilva@lynxtesoft.it>
  0 siblings, 2 replies; 4+ messages in thread

From: Jacopo Silva @ 2000-11-10 14:28 UTC (permalink / raw)
  To: pgsql-admin

I need to find out a quick way to check which groups a user
is member of.

In the pg_group table each group row has an array of
userids of the members of the group.
At the moment I am selecting all the rows than
searching in each array for the id of the user
I am looking for.

There should be something more elegant than this!!!
There should be a system table which I can use to find
the relation between user and groups.

I would be very grateful to anyone who can help me:-).

Bye,
Jacopo







^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: is a user in a group?
@ 2000-11-10 16:29  Peter Eisentraut <peter_e@gmx.net>
  parent: Jacopo Silva <jsilva@lynxtesoft.it>
  1 sibling, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2000-11-10 16:29 UTC (permalink / raw)
  To: Jacopo Silva <jsilva@lynxtesoft.it>; +Cc: pgsql-admin

Jacopo Silva writes:

> There should be something more elegant than this!!!

Correct.  And soon we'll implement something.

> There should be a system table which I can use to find
> the relation between user and groups.

And that is how we'll do it.

> I would be very grateful to anyone who can help me:-).

Sorry, at the moment there's no bettter way.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: is a user in a group?
@ 2000-11-10 17:58  Jie Liang <jliang@ipinc.com>
  parent: Jacopo Silva <jsilva@lynxtesoft.it>
  1 sibling, 0 replies; 4+ messages in thread

From: Jie Liang @ 2000-11-10 17:58 UTC (permalink / raw)
  To: Jacopo Silva <jsilva@lynxtesoft.it>; +Cc: pgsql-admin

Hi,

You need create a function use PLPGSQL(or PL/Perl) say:

ismember(groupname,username) return bool

since select grolist from pg_group where proname=groupname will return
you an array,
you can use a loop compare each element with the id from usesysid from
pg_user which match username.




Jacopo Silva wrote:

> I need to find out a quick way to check which groups a user
> is member of.
>
> In the pg_group table each group row has an array of
> userids of the members of the group.
> At the moment I am selecting all the rows than
> searching in each array for the id of the user
> I am looking for.
>
> There should be something more elegant than this!!!
> There should be a system table which I can use to find
> the relation between user and groups.
>
> I would be very grateful to anyone who can help me:-).
>
> Bye,
> Jacopo

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: is a user in a group?
@ 2000-11-11 08:55  Jacopo Silva <jsilva@lynxtesoft.it>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 4+ messages in thread

From: Jacopo Silva @ 2000-11-11 08:55 UTC (permalink / raw)
  To: pgsql-admin

Thanks!


For now I'll keep on doing searches on arrays, 
hoping for a new system table that manages
in a better way the relation between user and
groups.


Bye,
Jacopo 



----- Original Message ----- 
From: "Peter Eisentraut" <peter_e@gmx.net>
To: "Jacopo Silva" <jsilva@lynxtesoft.it>
Cc: <pgsql-admin@postgresql.org>
Sent: Friday, November 10, 2000 5:29 PM
Subject: Re: [ADMIN] is a user in a group?


> Jacopo Silva writes:
> 
> > There should be something more elegant than this!!!
> 
> Correct.  And soon we'll implement something.
> 
> > There should be a system table which I can use to find
> > the relation between user and groups.
> 
> And that is how we'll do it.
> 
> > I would be very grateful to anyone who can help me:-).
> 
> Sorry, at the moment there's no bettter way.
> 
> -- 
> Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
> 






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2000-11-11 08:55 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-10 14:28 is a user in a group? Jacopo Silva <jsilva@lynxtesoft.it>
2000-11-10 16:29 ` Peter Eisentraut <peter_e@gmx.net>
2000-11-11 08:55   ` Jacopo Silva <jsilva@lynxtesoft.it>
2000-11-10 17:58 ` Jie Liang <jliang@ipinc.com>

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