along with it u need to maintain the role id in usertables if 1:1 relation in roles and users is there and if there is many:1 relation in roles and users then maintain a table separate for userinroles with (userid,roleid) structure .
for my requirement i had move ahead with a 1:1 relation coz now its RBAC so no many:1 role relationship is required any more .
the spuser_validate procedure looks like this .
create procedure spUser_Validate
-- Add the parameters for the stored procedure here
@UserName nvarchar(50),
@Password nvarchar(128)
AS
--Declare local variables
Declare @ErrString VARCHAR(1000)
Declare @iRows INT
Declare @MyError INT
declare @Status int
DECLARE @iid INT
BEGIN
SELECT username FROM users WHERE susername=@UserName and password=@password
--result set of rights
select distinct permissionid,(objectname + permissionname) from rolepermissions where roleid in
(select roleid from userinroles where userid=(select userid from users where username=@username))
i will post the complete working sample with the sqlscripts , modified ptprincipal,ptidentity and objects as is .
![Smile [:)]](/emoticons/emotion-1.gif)
Govind