X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BF4A7D1DA9A for ; Tue, 27 Jan 2004 02:23:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 34515-08 for ; Mon, 26 Jan 2004 22:23:06 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 44462D1D4DD for ; Mon, 26 Jan 2004 22:23:02 -0400 (AST) Received: (qmail 10418 invoked by uid 500); 27 Jan 2004 02:24:16 -0000 Date: Mon, 26 Jan 2004 20:24:16 -0600 From: Bruno Wolff III To: James Taylor Cc: pgsql-sql@postgresql.org Subject: Re: Label Security Message-ID: <20040127022416.GA14179@wolff.to> Mail-Followup-To: James Taylor , pgsql-sql@postgresql.org References: <9A658A4A-5040-11D8-AA39-000A95982628@hatesville.com> <20040126210633.GA22394@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/219 X-Sequence-Number: 16612 On Mon, Jan 26, 2004 at 16:50:06 -0800, James Taylor wrote: > Ok, so for example, say I add another column to the tables I want to > have the row-level security on called 'security'. I would go ahead and > designate > different security levels for each user, (ex. Jane security 1000, Bill > 2000, Joe 3000). Then, if I only want X user with security 1000 to > view Y row, I set Y.security to 1000. > Then, I give these users no access to the table, and create views for > EACH user saying something to the effect of "select * from z where > security=securitylevel", and grant access to the views only to the user > itself. You can refer to current_user in the view. This allows you to use one view for all users. Though you still have to have some information mapping users to rows they can access in the database. > Couldn't a user then go into the console themselves and create a view > giving them full access to the table? You don't have to give them access to the table directly in order to have the view work. When accessing a table through a view you have the rights of the person who created the view.