SET ECHO ON
SPOOL XCUserRights.OUT

undefine tbl_owner
define tbl_owner = &1
undefine tbl_hdb 
define tbl_hdb = &2

-- XC_EXT_SITES
DROP PUBLIC SYNONYM XC_EXT_SITES;
CREATE PUBLIC SYNONYM XC_EXT_SITES FOR &&tbl_owner..XC_EXT_SITES;

GRANT SELECT ON &&tbl_owner..XC_EXT_SITES TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_EXT_SITES TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_EXT_SITES TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_EXT_SITES TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_EXT_SITES TO XCMANAGERS;


-- XC_EXT_SITESENSORS
DROP PUBLIC SYNONYM XC_EXT_SITESENSORS;
CREATE PUBLIC SYNONYM XC_EXT_SITESENSORS FOR &&tbl_owner..XC_EXT_SITESENSORS;

GRANT SELECT ON &&tbl_owner..XC_EXT_SITESENSORS TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_EXT_SITESENSORS TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_EXT_SITESENSORS TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_EXT_SITESENSORS TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_EXT_SITESENSORS TO XCMANAGERS;


-- XC_EXT_DATA1
DROP PUBLIC SYNONYM XC_EXT_DATA1;
CREATE PUBLIC SYNONYM XC_EXT_DATA1 FOR &&tbl_owner..XC_EXT_DATA1;

GRANT SELECT ON &&tbl_owner..XC_EXT_DATA1 TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_EXT_DATA1 TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_EXT_DATA1 TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_EXT_DATA1 TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_EXT_DATA1 TO XCMANAGERS;


-- XC_GOESQC
DROP PUBLIC SYNONYM XC_GOESQC;
CREATE PUBLIC SYNONYM XC_GOESQC FOR &&tbl_owner..XC_GOESQC;

GRANT SELECT ON &&tbl_owner..XC_GOESQC TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_GOESQC TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_GOESQC TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_GOESQC TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_GOESQC TO XCMANAGERS;


-- XC_RTUQC
DROP PUBLIC SYNONYM XC_RTUQC;
CREATE PUBLIC SYNONYM XC_RTUQC FOR &&tbl_owner..XC_RTUQC;

GRANT SELECT ON &&tbl_owner..XC_RTUQC TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_RTUQC TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_RTUQC TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_RTUQC TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_RTUQC TO XCMANAGERS;


-- XC_TXTDATA1
DROP PUBLIC SYNONYM XC_TXTDATA1;
CREATE PUBLIC SYNONYM XC_TXTDATA1 FOR &&tbl_owner..XC_TXTDATA1;

GRANT SELECT ON &&tbl_owner..XC_TXTDATA1 TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_TXTDATA1 TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_TXTDATA1 TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_TXTDATA1 TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_TXTDATA1 TO XCMANAGERS;


-- XC_PPLIST
DROP PUBLIC SYNONYM XC_PPLIST;
CREATE PUBLIC SYNONYM XC_PPLIST FOR &&tbl_owner..XC_PPLIST;

GRANT SELECT ON &&tbl_owner..XC_PPLIST TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_PPLIST TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_PPLIST TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_PPLIST TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_PPLIST TO XCMANAGERS;


-- XC_PPDATA1
DROP PUBLIC SYNONYM XC_PPDATA1;
CREATE PUBLIC SYNONYM XC_PPDATA1 FOR &&tbl_owner..XC_PPDATA1;

GRANT SELECT ON &&tbl_owner..XC_PPDATA1 TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_PPDATA1 TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_PPDATA1 TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_PPDATA1 TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_PPDATA1 TO XCMANAGERS;


-- XC_VER
DROP PUBLIC SYNONYM XC_VER;
CREATE PUBLIC SYNONYM XC_VER FOR &&tbl_owner..XC_VER;

GRANT SELECT ON &&tbl_owner..XC_VER TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_VER TO XCMANAGERS;
GRANT INSERT ON &&tbl_owner..XC_VER TO XCMANAGERS;
GRANT UPDATE ON &&tbl_owner..XC_VER TO XCMANAGERS;
GRANT DELETE ON &&tbl_owner..XC_VER TO XCMANAGERS;

--Views
-- XC_SITES
DROP PUBLIC SYNONYM XC_SITES;
CREATE PUBLIC SYNONYM XC_SITES FOR &&tbl_owner..XC_SITES;

GRANT SELECT ON &&tbl_owner..XC_SITES TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_SITES TO XCMANAGERS;


-- XC_SITESENSORS
DROP PUBLIC SYNONYM XC_SITESENSORS;
CREATE PUBLIC SYNONYM XC_SITESENSORS FOR &&tbl_owner..XC_SITESENSORS;

GRANT SELECT ON &&tbl_owner..XC_SITESENSORS TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_SITESENSORS TO XCMANAGERS;


-- XC_DATA1
DROP PUBLIC SYNONYM XC_DATA1;
CREATE PUBLIC SYNONYM XC_DATA1 FOR &&tbl_owner..XC_DATA1;

GRANT SELECT ON &&tbl_owner..XC_DATA1 TO XCUSERS;

GRANT SELECT ON &&tbl_owner..XC_DATA1 TO XCMANAGERS;

SPOOL OFF
