IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'GetUserRights')
	BEGIN
		DROP  Procedure  GetUserRights
	END

GO
/***********************************************
***功能描述：获取指定用户的直接权限
***传入传出参数：
***	@UserID：用户ID
***	@SubSystemID：子系统ID

***作者：
***建立时间:2009-1-6
***更改时间：
***更改人：
***更改原因：
****************************************************/
CREATE PROCEDURE [dbo].[GetUserRights]
	(
	@SubSystemID VARCHAR(6),
	@UserID int
	)
AS

SELECT Rights.RightID,Rights.RightName,Rights.RightDisplayName,RightType=RightsType.TypeName,RightTypeID,ParentGroup='',ParentGroupID='',RightMemo FROM Rights
	INNER JOIN User_Rights
		ON User_Rights.RightID=Rights.RightID
	INNER JOIN RightsType
			ON RightsType.TypeID = Rights.RightTypeID
	WHERE UserID=@UserID AND RightsType.SubSystemID=@SubSystemID