Обсуждение: Checking Permissions with SQL

Поиск
Список
Период
Сортировка

Checking Permissions with SQL

От
"Joseph"
Дата:
How would I be able to check whether I have select,update,insert,etc
permissions on a given table with an sql statement?

I am working on a generic php interface that lists all or some tables and
lets you edit them.

I want to get away from the permisssion denied error that php gives me.

Joseph Showalter


Re: Checking Permissions with SQL

От
"Oliver Elphick"
Дата:
"Joseph" wrote:
  >How would I be able to check whether I have select,update,insert,etc
  >permissions on a given table with an sql statement?

select relacl from pg_class where relname = 'my_table';

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Let the words of my mouth, and the meditation of my
      heart, be acceptable in thy sight, O LORD, my
      strength, and my redeemer."          Psalms 19:14



Re: Checking Permissions with SQL

От
Christopher Sawtell
Дата:
On Sat, 10 Feb 2001 00:17, Joseph wrote:
> How would I be able to check whether I have select,update,insert,etc
> permissions on a given table with an sql statement?
>
> I am working on a generic php interface that lists all or some tables
> and lets you edit them.
>
> I want to get away from the permisssion denied error that php gives me.

You have to GRANT whatever permissions are needed to the user the web
server run as. vis:-

grant select on school to nobody;
grant select on school_number_seq to nobody;

This enable the web server, which runs as 'nobody' to select and read from
the database.

school=# select relacl from pg_class where relname = 'school';
            relacl
-------------------------------
 {"=","chris=arwR","nobody=r"}
(1 row)


--
Sincerely etc.,

 NAME       Christopher Sawtell
 CELL PHONE 021 257 4451
 ICQ UIN    45863470
 EMAIL      csawtell @ xtra . co . nz
 CNOTES     ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

 -->> Please refrain from using HTML or WORD attachments in e-mails to me
<<--