Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Membership Roles.GetUsersInRole method
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Membership Roles.GetUsersInRole method
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01328847
Message ID:
01328847
Views:
95
Hi everybody,

Roles class (from MS) has GetUsersInRole method. This method is used in the wrapper class I got from Peter Kellner like this:
  [DataObjectMethod(DataObjectMethodType.Select, false)]
        static public List<RoleDataForMP> GetRoles(string userName, bool showOnlyAssignedRoles)
        {
            List<RoleDataForMP> roleList = new List<RoleDataForMP>();

            string[] roleListStr = Roles.GetAllRoles();
            foreach (string roleName in roleListStr)
            {
                bool userInRole = false;
                if (userName != null)
                {
                    userInRole = Roles.IsUserInRole(userName, roleName);
                }

                if (showOnlyAssignedRoles == false || userInRole == true)
                {
                    string[] usersInRole = Roles.GetUsersInRole(roleName);
                    RoleDataForMP rd = new RoleDataForMP();
                    rd.RoleName = roleName;
                    rd.UserName = userName;
                    rd.UserInRole = userInRole;
                    rd.NumberOfUsersInRole = usersInRole.Length;
                    roleList.Add(rd);
                }
            }

            return roleList;
        }
I could not find any other references to this method in our project.

My problem is that in our case we have SiteID as a custom Provider's property. And I want to return number of users only for the particular Site ID.

I'm not sure which method and how should I override.

Would you please suggest me the path to take?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform