Re: Controlling write access to a table

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Dave Coventry <dgcoventry(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Controlling write access to a table
Date: 2008-06-18 09:37:12
Message-ID: 4858D748.2090309@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dave Coventry wrote:
> Hi.
>
> I have a database with all of the particulars of our students and I am
> adding a table that will contain all of the courses and the grades
> attained by the students.

[snip]

> The marks (or grades) of the students are a different matter and we
> want to restrict changes to this data to a very few people.
>
> I'm presuming that this is not a unique problem, but I have been
> unable to find anything helpful on google.

If your different classes of users log in with different usernames and
passwords to the database, then you can do this rather simply with roles
and table priveleges. See the GRANT and REVOKE statements.

http://www.postgresql.org/docs/current/static/sql-grant.html
http://www.postgresql.org/docs/current/static/sql-revoke.html

and ROLE management:

http://www.postgresql.org/docs/current/static/sql-createrole.html

If your users all log in with the same username and password via some
kind of web app, persistence layer, or whatever, then you will have to
write the access control yourself at the application level.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2008-06-18 09:39:34 Re: problem with to_ascii() function in version 8.3.3
Previous Message David 2008-06-18 09:33:48 Re: Controlling write access to a table