Re: How to limit access only to certain records? - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: How to limit access only to certain records?
Date
Msg-id 20120622123251.GA30662@tux
Whole thread Raw
In response to How to limit access only to certain records?  (Andreas <maps.on@gmx.net>)
List pgsql-sql
Andreas <maps.on@gmx.net> wrote:

> Hi,
>
> is there a way to limit access for some users only to certain records?
>
> e.g. there is a customer table and there are account-managers.
> Could I limit account-manager #1 so that he only can access customers  
> only acording to a flag?

Yea, it's possible.

Write functions to access to the table (for select, for insert and so
on) as superuser, with secutity definer, revoke all rights from the
user.

Users can only access to the table with the functions, within this
functions check if the current_user has rights for the record.

There are some examples how to do that, please use google ;-)



Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


pgsql-sql by date:

Previous
From: Andreas
Date:
Subject: How to limit access only to certain records?
Next
From: Jov
Date:
Subject: Re: How to limit access only to certain records?