agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Gerardo Herzig <gherzig@fmed.uba.ar>
To: Alvin D?az <alvin.rd@live.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Access to table only through functions
Date: Mon, 7 May 2018 01:14:25 +0000 (UTC)
Message-ID: <1639829908.381388.1525655665344.JavaMail.zimbra@fmed.uba.ar> (raw)
In-Reply-To: <1203421770.381387.1525655659092.JavaMail.zimbra@fmed.uba.ar>
References: <MWHPR17MB1392E52A397D68771E70D20BE7840@MWHPR17MB1392.namprd17.prod.outlook.com>
----- Mensaje original -----
> De: "Alvin D?az" <alvin.rd@live.com>
> Para: pgsql-sql@lists.postgresql.org
> Enviados: Domingo, 6 de Mayo 2018 19:51:09
> Asunto: Access to table only through functions
> I am working in a software but I am using and approach in which business logic
> is in the database this way programmers only have to worry about what functions
> they have to call to perform some action or wich view query to get certain data
> but for this work perfectly I need to prevent developers to realize direct CRUD
> operations against the tables so is there a way that I could just allow a db
> user have permission to execute functions but not to perform actions on tables
>
> Example:
>
> 1- table_user(id int, name text)
> 2- function_save_user(id int, name int).......
>
> You can insert using the function but not writing direct insert statement.
>
What you want is the "security definer" option when create functions. See
https://www.postgresql.org/docs/current/static/sql-createfunction.html
HTH
Gerardo
view thread (3+ messages) latest in thread
Message-ID: <1639829908.381388.1525655665344.JavaMail.zimbra@fmed.uba.ar>
Permalink: ../1639829908.381388.1525655665344.JavaMail.zimbra@fmed.uba.ar/
Also on: postgresql.org/message-id/1639829908.381388.1525655665344.JavaMail.zimbra@fmed.uba.ar
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: gherzig@fmed.uba.ar, alvin.rd@live.com, pgsql-sql@lists.postgresql.org
Subject: Re: Access to table only through functions
In-Reply-To: <1639829908.381388.1525655665344.JavaMail.zimbra@fmed.uba.ar>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox