Hot to restrict access to subset of data - Mailing list pgsql-general

From Andrus
Subject Hot to restrict access to subset of data
Date
Msg-id da3979$27os$1@news.hub.org
Whole thread Raw
Responses Re: Hot to restrict access to subset of data
Re: Hot to restrict access to subset of data
List pgsql-general
I have table of documents

CREATE TABLE document ( DocumentType CHARACTER(1), .... )

DocumentType field determines the document type stored in record.

I want to restrict access to this table based on the user name, document
type and access level. I have 3 levels: no access, view only, modify access.

Example:

User A can only view documents of type X and modify documents of type Y
User B can only view documents of type Z

I created application which implements those restictions.

Unfortunately, users can run pgAdmin and bypass the access restrictions.

I'm thinking about two solutions:

1. Postgres should automatically modify WHERE clauses to apply restrictions
based on user name.

For example, if user A runs query from pgAdmin

SELECT * FROM document

Postgres should actually run the query

SELECT * FROM document WHERE DocumentType IN ('X','Y')

2. Postgres should allow access from my application only. Is it possible to
use authentication method which allows access from my application only ?

Users connect to 5432 port from internet.
I'm using Postgres 8 in Windows from Windows ODBC clients.

Any idea how to implement this ?

Andrus.



pgsql-general by date:

Previous
From: Ajay Dalvi
Date:
Subject: How to uninstall PostGreSql from linux
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL sequence within function