pg.ddx.io pgsql-performance@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Friends <ramasamy.p@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: security for row level but not based on Database user's
Date: Tue, 25 Apr 2006 10:40:08 +0100
Message-ID: <444DEE78.7020703@archonet.com> (raw)
In-Reply-To: <1145615328.300612.56380@e56g2000cwe.googlegroups.com>
References: <1145615328.300612.56380@e56g2000cwe.googlegroups.com>
Friends wrote:
> Hi
>
> I need to set security for row level but not based on Database user's
> login. It should be based on the user table login. For the particular
> user I need to allow only the particular records to access insert,
> update delete and select.
Well, the data access stuff is all manageable via views, which is the
standard way to do this.
You don't say which version of PostgreSQL you are using, but I'd be
tempted just to switch to a different user after connecting and use the
session_user system function to control what is visible in the view.
For example:
CREATE VIEW my_contacts AS SELECT * FROM contacts WHERE owner =
session_user;
If that's not practical then you'll need to write some functions to
simulate your own session_user (say application_user()). This is easiest
to write in plperl/pltcl or some other interpreted language - check the
list archvies for plenty of discussion.
--
Richard Huxton
Archonet Ltd
view thread (3+ messages) latest in thread
Message-ID: <444DEE78.7020703@archonet.com> Permalink: ../444DEE78.7020703@archonet.com/ Also on: postgresql.org/message-id/444DEE78.7020703@archonet.com ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients using the --to and --cc options: reply via email To: pgsql-performance@postgresql.org Cc: dev@archonet.com, ramasamy.p@gmail.com Subject: Re: security for row level but not based on Database user's In-Reply-To: <444DEE78.7020703@archonet.com> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
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