Re: About permissions on large objects - Mailing list pgsql-general

From Giuseppe Sacco
Subject Re: About permissions on large objects
Date
Msg-id 1310722785.4673.12.camel@scarafaggio
Whole thread Raw
In response to Re: About permissions on large objects  (Howard Cole <howardnews@selestial.com>)
List pgsql-general
Hi Howard,

Il giorno mer, 13/07/2011 alle 23.30 +0100, Howard Cole ha scritto:
> Hi Guiseppe,
>
> Perhaps you can create a trigger that monitors for the insertion of an
> oid and then grant permissions. No idea if this can be done, but if it
> can it will save you lots of repeated grants.
[...]

Thanks for your tip. I already created a trigger on all my tables, as
this one:

CREATE OR REPLACE FUNCTION grant_large_object() RETURNS trigger AS '
BEGIN
execute ''GRANT SELECT,UPDATE ON LARGE OBJECT '' || NEW.IMAGE || '' TO agenzia_r'';
RETURN NEW;
END;'
LANGUAGE 'plpgsql';

CREATE TRIGGER grant_large_object
AFTER INSERT OR UPDATE ON agenzia.imagebydocument
FOR EACH ROW EXECUTE PROCEDURE grant_large_object();

And it seems to be working right. I still would like to know if there is
any way to query acl metadata, maybe from table
pg_catalog.pg_largeobject_metadata in order to collect information about
granted rights on large objects.

Bye,
Giuseppe


pgsql-general by date:

Previous
From: Gregor Trefs
Date:
Subject: C function returns null values
Next
From: Tony Wang
Date:
Subject: Re: Weird problem that enormous locks