UPDATE TBDD_BASECONFIG SET DB_VERSION = '1.9.0.0'
GO
CREATE VIEW [dbo].[VWDD_WM_ACCESS_RIGHTS_USER] AS
SELECT AR.dwObjectID,
	AR.dwUserOrGROUPID,
	AR.dwAccessRight,
	AR.dwObjectDBID 
FROM windream60.dbo.AccessRight AR LEFT JOIN windream60.dbo.UserGroup UG  ON AR.dwUserOrGroupID  = UG.dwGroupID 
	INNER JOIN TBDD_USER TU ON AR.dwUserOrGroupID = TU.USERID_FK_INT_ECM
WHERE UG.dwUserOrGroupID IS NULL
GO

CREATE VIEW [dbo].[VWDD_WM_ACCESS_RIGHTS_GROUP] AS
SELECT AR.dwObjectID,
	UG.dwUserOrGROUPID,
	AR.dwAccessRight,
	AR.dwObjectDBID 
FROM windream60.dbo.AccessRight AR LEFT JOIN windream60.dbo.UserGroup UG  ON AR.dwUserOrGroupID  = UG.dwGroupID 
	INNER JOIN TBDD_USER TU ON UG.dwUserOrGroupID = TU.USERID_FK_INT_ECM
WHERE UG.dwUserOrGroupID IS NOT NULL
GO

CREATE VIEW [dbo].[VWDD_WM_ACCESS_RIGHTS] AS
SELECT ARU.dwObjectID,
	ARU.dwUserOrGROUPID,
	ARU.dwAccessRight,
	ARU.dwObjectDBID 
FROM VWDD_WM_ACCESS_RIGHTS_USER ARU UNION
SELECT ARG.dwObjectID,
	ARG.dwUserOrGROUPID,
	ARG.dwAccessRight,
	ARG.dwObjectDBID 
FROM VWDD_WM_ACCESS_RIGHTS_GROUP ARG
GO



