-- Set the default user rights

USE XC_DATA
GO

-- XC_SITES
GRANT SELECT ON XCMANAGER.XC_SITES TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_SITES TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_SITES TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_SITES TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_SITES TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_SITESENSORS
GRANT SELECT ON XCMANAGER.XC_SITESENSORS TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_SITESENSORS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_SITESENSORS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_SITESENSORS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_SITESENSORS TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_DATA1
GRANT SELECT ON XCMANAGER.XC_DATA1 TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_DATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_DATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_DATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_DATA1 TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_GOESQC
GRANT SELECT ON XCMANAGER.XC_GOESQC TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_GOESQC TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_GOESQC TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_GOESQC TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_GOESQC TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_RTUQC
GRANT SELECT ON XCMANAGER.XC_RTUQC TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_RTUQC TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_RTUQC TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_RTUQC TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_RTUQC TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_TXTDATA1
GRANT SELECT ON XCMANAGER.XC_TXTDATA1 TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_TXTDATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_TXTDATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_TXTDATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_TXTDATA1 TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_PPLIST
GRANT SELECT ON XCMANAGER.XC_PPLIST TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_PPLIST TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_PPLIST TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_PPLIST TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_PPLIST TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_PPDATA1
GRANT SELECT ON XCMANAGER.XC_PPDATA1 TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_PPDATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_PPDATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_PPDATA1 TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_PPDATA1 TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_VER
GRANT SELECT ON XCMANAGER.XC_VER TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_VER TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_VER TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_VER TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_VER TO XCMANAGERS WITH GRANT OPTION
GO

-- XC_POLLGROUPS
GRANT SELECT ON XCMANAGER.XC_POLLGROUPS TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_POLLGROUPS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_POLLGROUPS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_POLLGROUPS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_POLLGROUPS TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_LOG
GRANT SELECT ON XCMANAGER.XC_LOG TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_LOG TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_LOG TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_LOG TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_LOG TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_USERS
GRANT SELECT ON XCMANAGER.XC_USERS TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_USERS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_USERS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_USERS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_USERS TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_TEMPLATES
GRANT SELECT ON XCMANAGER.XC_TEMPLATES TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_TEMPLATES TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_TEMPLATES TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_TEMPLATES TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_TEMPLATES TO XCMANAGERS WITH GRANT OPTION
GO



-- XC_RECORDIDS
GRANT SELECT ON XCMANAGER.XC_RECORDIDS TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_RECORDIDS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_RECORDIDS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_RECORDIDS TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_RECORDIDS TO XCMANAGERS WITH GRANT OPTION
GO


-- XC_SITESENSORSDECODE
GRANT SELECT ON XCMANAGER.XC_SITESENSORSDECODE TO XCUSERS
GO

GRANT SELECT ON XCMANAGER.XC_SITESENSORSDECODE TO XCMANAGERS WITH GRANT OPTION
GO

GRANT INSERT ON XCMANAGER.XC_SITESENSORSDECODE TO XCMANAGERS WITH GRANT OPTION
GO

GRANT UPDATE ON XCMANAGER.XC_SITESENSORSDECODE TO XCMANAGERS WITH GRANT OPTION
GO

GRANT DELETE ON XCMANAGER.XC_SITESENSORSDECODE TO XCMANAGERS WITH GRANT OPTION
GO


-- Views for XCONNECT
CREATE VIEW XCONNECT.XC_SITES 
AS 
	SELECT * FROM XCMANAGER.XC_SITES
GO

CREATE VIEW XCONNECT.XC_SITESENSORS 
AS 
	SELECT * FROM XCMANAGER.XC_SITESENSORS
GO

CREATE VIEW XCONNECT.XC_DATA1 
AS 
	SELECT * FROM XCMANAGER.XC_DATA1
GO

CREATE VIEW XCONNECT.XC_GOESQC 
AS 
	SELECT * FROM XCMANAGER.XC_GOESQC
GO

CREATE VIEW XCONNECT.XC_RTUQC
AS 
	SELECT * FROM XCMANAGER.XC_RTUQC
GO

CREATE VIEW XCONNECT.XC_PPDATA1
AS 
	SELECT * FROM XCMANAGER.XC_PPDATA1
GO

CREATE VIEW XCONNECT.XC_PPLIST
AS 
	SELECT * FROM XCMANAGER.XC_PPLIST
GO

CREATE VIEW XCONNECT.XC_TXTDATA1
AS 
	SELECT * FROM XCMANAGER.XC_TXTDATA1
GO

CREATE VIEW XCONNECT.XC_VER
AS 
	SELECT * FROM XCMANAGER.XC_VER
GO

CREATE VIEW XCONNECT.XC_LOG
AS
	SELECT * FROM XCManager.XC_LOG
GO

CREATE VIEW XCONNECT.XC_POLLGROUPS
AS
	SELECT * FROM XCManager.XC_POLLGROUPS
GO

CREATE VIEW XCONNECT.XC_USERS
AS
	SELECT * FROM XCManager.XC_USERS
GO

CREATE VIEW XCONNECT.XC_TEMPLATES
AS
	SELECT * FROM XCManager.XC_TEMPLATES
GO

CREATE VIEW XCONNECT.XC_RECORDIDS
AS
	SELECT * FROM XCManager.XC_RECORDIDS
GO

CREATE VIEW XCONNECT.XC_SITESENSORSDECODE
AS
	SELECT * FROM XCManager.XC_SITESENSORSDECODE
GO
