Consultor Eletrônico



Kbase P55080: How to create SQL user with only read permissions on PUB tables
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/08/2008
Status: Verified

GOAL:

How to create SQL user with only read permissions on PUB tables

GOAL:

How to create SQL users that only have read permissions for all tables that have a Table Owner of PUB?

FACT(s) (Environment):

Progress 9.1x
All Supported Operating Systems
OpenEdge 10.x

FIX:

GRANT SELECT statement works only for one table at a time. By default a SQL-92 user has no privileges when gets created by "CREATE USER" statement. However you can generate the SQL statements from 4GL using the following code:

DEF VAR vcUser AS CHARACTER.
vcUser = "readuser". /* you have to use your user name here */

OUTPUT TO readonly.sql.
FOR EACH _file WHERE NOT _hidden :
PUT UNFORMATTED
'GRANT SELECT ON PUB."' _file-name '" TO ' vcUser ' ;' SKIP.
END.
PUT UNFORMATTED "COMMIT ;" SKIP.
OUTPUT CLOSE.