You can (should) call ProviderCapabilities.AddProvider() explicitly in your provider's Initalize()-implementation to
specify both what actions are supported and what symbol should be used for wildcardsearches.
/johan
Coseptually I'm not one 100% comfortable with the way this is implemented, since one has has to write code to add a new provider. One can not take an out of the box provider and just make search work with episerver. Unless you are luck and the underlying datastructure happens to use % as a wirldcard.
And to make things worse, EPiServer does not use the ProviderCapabilities where they should, have a look at at EPiServer.UI.Edit.MembershipBrowser, it's used by the /edit/MembershipBrowser:
private List<MembershipUser> SearchUsersAndEmail(string name, string email)
{
MembershipUserCollection users = Membership.FindUsersByName("%" + name + "%");
MembershipUserCollection users2 = Membership.FindUsersByEmail("%" + email + "%");
List<MembershipUser> list = new List<MembershipUser>();
Here % is hardcoded, so no AD provider will return a hit.
Regards,
Morten
Agreed, it would indeed be nice if ProviderCapabilities were configurable through web.config.
As for the hardcoded wildcards I'd say: "Shame on us!"
I've reported to the frontend team.
Thanks for bringing it to our notice!
Best regards,
johan
Hi All
This is a sort of FYI post :-)
Thought I'd share what we've found with regards to implementing our own membership provinder. Actually it's Johan Olofssons modified ActiveDirectoryMembershipProvider.
It basically only overrides the GetUser, and normalizes the user name, so we were a little bit surprised when the useres came and said they could not search for spesific users in admin mode. Fetch all users went fine, but not filtered by name or e-mail.
This was odd since the findbyemail and username functions had not been overrided.
After looking around for a bit we found the culprit.
EPiServer.Security.ProviderCapabilities, and in the constructor:
Here it adds * as wildcard for typeof(ActiveDirectoryMembershipProvider), but since our provider is of another type not setup here we get a % as wildcard from the searchuser.aspx in admin...
This sort of setting up is, in my opinion bad when we are dealing with providers, it takes away the agnostic of the provider model.
Had EPiServer at least used "is" instead of typeof to determine the type, inherited classes would have resolved.
So to make things messier we added our own settings in the application_start event :-(
Regads,
Morten