Altering privs (sorry, mailed wrong one)
Posted in 1991
I write
> I haven't embarrassed myself in public for a little while, so how 'bout
and promptly mail the wrong lump of text. ARGHHH !!! Sorry folks :-(
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?
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;!!
end
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;!!
end
From sh(1) or ksh(1):
for tab in tab1 tab2 tab3
do
isql mydb <<!!
grant insert on $tab to foo;
revoke delete on $tab from foo;!!
done
or,
for tab in `cat tab_list_file`
do
isql mydb <<!!
grant insert on $tab to foo;
revoke delete on $tab from foo;!!
done
You can get slightly better value with code like:
for tab in tab1 tab2 tab3
do
echo "grant insert on $tab to foo; revoke delete on $tab from foo;"
done |
isql mydb
since it then doesn't keep exec'ing the informix stuff.
> 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, and sorry again !
Tony.
__________________________________________________________________________
Tony Heskett th@bnr.co.uk Voice: (+44) 279 429531 x 2637
BNR, London Road, Harlow, Essex, CM17 9NA Fax: (+44) 279 454187