Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I check for user roles?

Status
Not open for further replies.

RichieMac

Programmer
Aug 18, 2004
61
GB
Hi all,

I have written a simple login screen. I have an Access datbase that holds 3 fields - Username, Password and Role. I can authenticate the user but what I now want to do is only carry out the required behaviour corresponding to the role(s) the user has. i.e. if the user has a role of manager then he/she can only behave as the system says a manager should.

I know there is a way to use the Windows account but have no idea how this would work and if it would be benificial to my simple solution.

If there is anyone out there that can point me in the right direction, because I'm totally new to these security issues, I would be very grateful.

Thank you in advance.
Richie
 
Are you using ASP.Net or Windows forms? I belive they work somewhat differently. I've only ever done this in ASP.Net but in Wondows forms I think you can use a WindowsIdentity class from System.Security.Principal. You use the GetCurrent() method to return a WindowsIdentity object for the current user which you can then work with.

In ASP.Net Page.User has an IsInRole() method.

Nelviticus
 
Hi Nel,

No I'm not using ASP. I'll look into the WindowsIdentity object and see what I come up with.

Thanks for the pointer.

Richie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top