Why there is no function to Get List of User Roles in Identity.vb class ?

Why there is no function to Get List of User Roles in Identity.vb class ?

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


tarekahf posted on Tuesday, May 27, 2008

I am writing a security controller class that will collaborate with the Basic CSLA Security Model "Identity" class and "Pricipal" class (as per the PTracker Sample Application).

I need to get a list of user roles, but I could not find a property or function for this purpose, although the Roles are being loaded in the Private Variable "mRoles". Any reason ?

So, I decided to add the following property to the Identity class, in the region " IsInRole ":

        Friend ReadOnly Property Roles() As List(Of String)
            Get
                Return mRoles
            End Get
        End Property

I need to know if this is OK or if there is an alternative.

Why I need such property ?

I am developing a Testing Page, and I need to add a Drop-Down Box to show the List of the Roles for a Selected User. So it does make sense to add such property "Roles()".

I was thinking probably it should be under the Membership Provider, but I was really not sure where is should be added.

Please let me know your feedback.

Tarek.

Copyright (c) Marimer LLC