Altering privileges on lots of tables
Posted in 1991
RUCHI@CFRVM.CFR.USF.edu writes:
> I have number of tables that I would like to give access to users. Currently,
> I am using INFORMIX/SQL to do this one at a time. Is there anyway I can
> run this in a group if I have it in a file?
I haven't embarrassed myself in public for a little while, so how 'bout
these ? Note that you can type these on the command line.
If you put them in a script, you probably want "#!/bin/sh" or ":" on
the first line, for sh(1), and "#!/bin/csh" on the first line for csh(1).
From csh(1):
foreach tab (tab1 tab2 tab3) # tab1, tab2, tab3 are table names
isql mydb <<!!
grant insert on $tab to foo;
revoke delete on $tab from foo;!!
or,
foreach tab (`cat tab_list_file`) # file is whitespace separated tbl names
isql mydb <<!!
grant insert on $tab to foo;
revoke delete on $tab from foo;!!
From sh(1) or ksh(1):
for tab in (tab1 tab2 tab3)
isql mydb <<!!
grant insert on $tab to foo;
revoke delete on $tab from foo;!!
or,
for tab in (`cat tab_list_file`)
isql mydb <<!!
grant insert on $tab to foo;
revoke delete on $tab from foo;!!
> By the way, I like to understand the table authorization "su-id--" that is
> generated table systabauth. Is there anywhere in INFORMIX book I can read
> more about it?
Guessing (yup, bad idea :-) select, update, insert, delete. Your other
choices are alter and index. If no-one comes back (Jim, you did a function
for this, didn't ya ?), revoke the whole lot and grant them one at a
time, watching carefully !
Merry Christmas folks !
Tony.
__________________________________________________________________________
Tony Heskett th@bnr.co.uk Voice: (+44) 279 429531 x 2637
BNR, London Road, Harlow, Essex, CM17 9NA Fax: (+44) 279 454187