How do I get a list of roles for user?

How do I get a list of roles for user?

Old forum URL: forums.lhotka.net/forums/t/4276.aspx


meierk posted on Friday, February 01, 2008

Sorry if I missed when I searched for this.  I am new to both CSLA and .NET and I am not seeing how I get get a list of roles for the logged in user.  In my case, the application is a WinForms app, but will be deployed in a couple of locations, one using Windows security and the other use CSLA.

Given that I will be using both security modes, is there a way to get a list of all roles (domain or database) for a user or do I have to build the list be testing for each role that the application is concerned with?

Thx,
Kevin

RockfordLhotka replied on Friday, February 01, 2008

Unfortunately the .NET IPrincipal interface only defines IsInRole(), so there's no way to get the list of roles for the current principal (user).

When you create a custom principal you can obviously add your own method to return the list of roles. But that doesn't help with the WindowsPrincipal - I'm not sure of a solution there...

Copyright (c) Marimer LLC