pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hari.fuchs@gmail.com
To: pgsql-sql@postgresql.org
Subject: Re: How to limit access only to certain records?
Date: Fri, 22 Jun 2012 16:52:35 +0200
Message-ID: <87r4t78klo.fsf@hf.protecting.net> (raw)
References: <4FE458AB.4000109@gmx.net>

Andreas <maps.on@gmx.net> writes:

> 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?

Maybe something like the following:

CREATE TABLE test1 (
  id serial NOT NULL,
  val text NOT NULL,
  _user text NOT NULL,
  PRIMARY KEY (id)
);

COPY test1 (val, _user) FROM stdin;
for user1#1	user1
for user1#2	user1
for user2#1	user2
\.

CREATE VIEW test1v AS
SELECT id, val
FROM test1
WHERE _user = current_user;




view thread (7+ messages)  latest in thread

Message-ID: <87r4t78klo.fsf@hf.protecting.net>
Permalink:  ../87r4t78klo.fsf@hf.protecting.net/
Also on:    postgresql.org/message-id/87r4t78klo.fsf@hf.protecting.net

 · 

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-sql@postgresql.org
  Cc: hari.fuchs@gmail.com
  Subject: Re: How to limit access only to certain records?
  In-Reply-To: <87r4t78klo.fsf@hf.protecting.net>

* 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