I want to get all the membership roles in the system and all the members in the system.
I've tried using
System.Web.Security.Roles.GetAllRoles();
System.Web.Security.Roles.GetUsersInRoles(roles[0]);
and a couple of others, but they all throw the not implemented error.
I'm using a clean VisualStudio Umbraco template of V5.1 running locally on IIS Express and SQL Express.
Any thoughts would be much appreciated.
I noted that the provider was not queried in populating the role listing from the backoffice and came to the conclusion that not only was getallroles not called, it was never implemented.
Instead, the hive is queried for the list of roles.
Despite the claim that membership services was baked-in again starting with 5.1, it comes with some particularly serious limitations.
If you're committed to 5.1 and you need a custom roleprovider, then you'll need to come up with a solution that occasionally syncs roles to Umbraco.
If you don't need a custom roleprovider, then you can query the hive to pull the related content. The special urls are:
security://profiles
Used to store profile data by the Hive Membership Wrapper. Profile data is additional data for any member/user that cannot be stored in the ASP.Net MembershipProvider
security://user-groups
Used to store the data for back office user groups/roles.
security://member-groups
Used to store the data for members' groups/roles.
security://member-types
Used to store the schema data for member types
security://membership-data
Used by the UmbracoMembershipProvider to store the ASP.Net MembershipProvider information
security://users
Used to query the Hive membership provider wrapper for back office users
security://members
Used to query the Hive membership provider wrapper for Umbraco members
Finally, be aware that membership services are now abstracted. There's a completely new separate interface for Umbraco's take on membership.
Rather than using the 'baseline' .net membership provider and role provider, you use the membership service available in your current IRoutableRequestContext:
e.g. rather than using Membership.ValidateUser(), you would use _context.Application.Security.Members.Validate() which wraps the supplied MembershipProvider.
Good luck, and post any findings of your own as the community trudges through this release together.
EDIT: An example for getting a list of the member roles