I need to add FBA users to SPGroups instead of merely FBA roles

I have a web part that lists users who are members of a sharepoint group that has rights to a list.

It is very convenient to add FBA users to roles when creating them with your SharePoint 2010 FBA Pack, but when I try to list SPUsers for the FBA SPGroup, I only pull the FBA role name, and don't get the role members.

If I add an FBA user to an SharePoint Group directly without using a role, then the code works fine and I see the users.

So I think I either need to figure out how to list the members of a role programmatically, or I think I'd like to modify the FBA user creation dialog to provide a list of SPGroups instead of, or in addition to, the list of roles.

Here's a snippet from the code which lists the members of an SPGroup. But when I run this and it hits an FBA role, It shows the FBA group, but does not show the members; indeed, it lists the group itself as a user

// if the SPGroup grpRoleGroup has at least one member..
if (grpRoleGroup.Users.Count > 0)
   {
   string strGroupName = grpRoleGroup.Name;

   // add each user to the report table string
   foreach (SPUser usrUser in grpRoleGroup.Users)
       {
       permReport = permReport + "<tr><td width=\"33%\">" +
       grpRoleGroup.Name.ToString() + "</td><td>" +        
       usrUser.LoginName.ToString() + "</td><td>" + 
       usrUser.Name.ToString() + "</td></tr>";
       }
    }

Unfortunately my understanding is that SharePoint does the FBA role rights assignment in the back end, so I don't think you're going to get a list of members using the SharePoint functions. You can use the Membership functions to get the list of users:

http://msdn.microsoft.com/en-us/library/system.web.security.roles.getusersinrole.aspx

And if you'd prefer to use SharePoint groups instead of FBA roles on the user creation page, no need to modify any code. You can set that option on the FBA Site Configuration page.

Oh, I'm an idiot. I download the sourcecode and start looking at the UserNew.aspxc and note that it has a built in function to show groups if roles are disabled. "Cool! So now I need to figure out how it makes the determination as to whether roles are enabled."

I'm clicking from definition to definition in your project and find that, dang it, there's check-box in the FBA Site Configuration, all I needed to do was clear the check-box.

*sigh*

Anyway.... I do very much enjoy the FBA Pack.

ccoulson wrote:

And if you'd prefer to use SharePoint groups instead of FBA roles on the user creation page, no need to modify any code. You can set that option on the FBA Site Configuration page.


Yeah, paint me stupid, I didn't even notice that checkbox until I painstakingly revealed it by exploring your source code. Pfft!