Re: READ ONLY DATABASE
Posted in 1996
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration, Security, Permissions & Auditing
Nils Myklebust wrote: > > sinyem@pc.jaring.my wrote: > > :Is this anything like read-only database, something like > :GRANTing SELECT ON all TABLE(s) TO user_name or > :GRANTing SELECT ON database_name TO user_name ? > > :I refering to granting view-only to *every* tables in a database to > :a particular users. Granting select to each table would be tedious > :since there could be lots and lots of tables in a database. > > :Product > :------- > > :Informix-4GL 4.x > :Informix-OnLine 4.x > > It is however easy to write a select statement selecting table names > from systables and automatically creating the grant statements. Send > the output to a file and execute the file. > Something along these lines: > > select "grant select on ", tabname, " to username" > from systables > where tabid >99 I much prefer: OUTPUT TO "myscript.sql" WITHOUT HEADINGS SELECT "GRANT SELECT ON " || tabname || " TO username;" FROM systables WHERE tabid > 99 Because you can then simply run myscript.sql with no changes. > You may have to create revoke statements first to revoke all from > public. Also, beware that 'REVOKE ALL FROM public' DOES NOT remove user specific permissions. These have to be done one by one!!!! I once wrote a script that removed ALL entries from sysusers, systabauth, and syscolauth. Then proceeded to run GRANT commands taking users from files. Not forgetting of course to INSERT Informix back as DBA!!! I DON'T RECOMMEND THIS for those that don't have BIG balls, or a SOUND-PROOF office. But it worked for us at that time. Cheers, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | The Informix FAQ is at http://www.iiug.org | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+