GRANT SELECT
Posted in 2012
Topics: Security, Permissions & Auditing
Want to grant SELECT on all tables for a specified user.
How can you do something like:
REVOKE ALL FROM 'my_user'
GRANT SELECT ON 'all_tables' to 'my_user'
Thanks
You can't. But in my utils4_ak package in the IIUG Software Repsitory
there are AWK scripts to post process myschema or dbschema output to
produce shell and SQL scripts that operate on every table in a database.
You can edit one of the simple ones, like mktruncate.awk, to produce a new
one that will generate the GRANT commands for you.
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.
On Thu, Aug 30, 2012 at 12:31 AM, DERRICK MULLER <derrick@xact.co.za> wrote:
> Want to grant SELECT on all tables for a specified user.
>
> How can you do something like:
>
> REVOKE ALL FROM 'my_user'
> GRANT SELECT ON 'all_tables' to 'my_user'>
> Thanks
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--90e6ba3fcba3ecfe7904c874f905
You can generate the instructions based on system catalog queries. The
tables to look for should be systabauth, systables, sysfragauth (if you
have fragmented tables) and... (I may be missing some)
On Aug 30, 2012 5:31 AM, "DERRICK MULLER" <derrick@xact.co.za> wrote:
> Want to grant SELECT on all tables for a specified user.
>
> How can you do something like:
>
> REVOKE ALL FROM 'my_user'
> GRANT SELECT ON 'all_tables' to 'my_user'>
> Thanks
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--20cf306681572a21d504c87530ec
Thanks Art Will give that a bash Derrick
Hi Derrick,
Here is an SQL script that can generate GRANTs for you on all of your
tables for a particular database.
Connect to database using dbaccess and run:
OUTPUT TO grant_select.sql WITHOUT HEADINGS
SELECT "GRANT SELECT ON "||trim(tabname)||" TO <your_user>;"
FROM systables
WHERE tabid>99
AND tabtype="T";
Then you can just run the resulting SQL script for your database of
choice. You can also replace "your_user" by $1 in the script and pass a
parameter to your script. You can also put the resulting script in a
shell script that contains dbaccess in order to run it for your database
of choice.
You get the idea.
Cordialement, Regards,
Khaled Bentebal
Directeur Général - ConsultiX
Président UGIF - User Group Informix France
IIUG - Board of Directors
Tél: 33 (0) 1 39 12 18 00
Fax: 33 (0) 1 39 12 18 18
Mobile: 33 (0) 6 07 78 41 97
Email: khaled.bentebal@consult-ix.fr
Site Web: www.consult-ix.fr
Le 30/08/12 06:31, DERRICK MULLER a écrit :
> Want to grant SELECT on all tables for a specified user.
>
> How can you do something like:
>
> REVOKE ALL FROM 'my_user'
> GRANT SELECT ON 'all_tables' to 'my_user'>
> Thanks
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>