This project has moved. For the latest updates, please go here.

Query within site collection

Mar 6, 2016 at 6:52 PM
I would like the picker to only return users who are in the site collection where the user is performing the search from. Which method do I need to override to filter the results?
Coordinator
Mar 9, 2016 at 12:29 PM
Hello,
LDAPCP cannot help you for that: when it is called, assuming it is configured for this web app/zone, LDAPCP should always return results if it can.
What you want is to find a way so that SharePoint does NOT call LDAPCP, that's not Something you can achieve by overriding any method in LDAPCP.
Thanks,
Yvan
Mar 9, 2016 at 12:43 PM
What if I override the FillSearch function with the same exact code found in the LDAPCP base class function, but instead of adding every returned user to the searchtree hierarchy, I ignore those that are not in the site collection? Would that not work?

// On purpose, if this property is true, LDAP lookp is completely bypassed
List<PickerEntity> entities = CreatePickerEntityForSpecificClaimTypes(
input,
attributes.FindAll(x => !x.CreateAsIdentityClaim),
false
);

if (results != null && results.Count > 0)
{
foreach (var result in results)
{
  __# Check if current user exists in site collection. If true, execute__:
  matchNode.AddEntity(entity);
}
}
Coordinator
Mar 9, 2016 at 4:45 PM
Edited Mar 9, 2016 at 4:46 PM
Hmm, yes, I think that scenario will work.
I'm just not sure if FillSearch will be called on every scenario where you want to restrict the permissions returned, maybe you'll have to override FillResolve([...]string[...]) as well.
But in any case, you should not override FillResolve([...]SPClaim[...])

Quick question for you: would that help if LDAPCP had an overridable method that would always be called after permissions are created, but before they are added to the list (so that you have a chance to remove the ones already created, and add new ones)?

Thanks,
Yvan
Mar 9, 2016 at 7:02 PM
Absolutely that would help. It would give me the chance to remove the permissions for all the users who are not members of the site collection before displaying them in the list. If I can get the context uri of the site collection inside this overloaded method, then I'll be set.

I agree with you that the FillSearch will not cover every scenario for me, and that I would have to override FillResolve also. I wanted to take it one step a time, and get it working for FillSearch first before I tackled other methods. I actually tried overriding FillSearch today but I ran into an exception, and did not mess around too much with it. If you provide an overridable method that I can use, then I don't even need to mess around with overriding FillSearch or FillResolve. I'll just remove the permissions that I don't need and then return the updated permission collection back to the base class for display in the list. That would be great!

Thanks.
Coordinator
Mar 10, 2016 at 4:09 PM
Ok :)
I will implement it, but I don't want to commit on any timeframe when it will be available.
thanks,
Yvan
Mar 11, 2016 at 12:53 AM
Edited Mar 11, 2016 at 12:54 AM
Fantastic! I will be anxiously awaiting :)

Thanks, Yvan.
Coordinator
Mar 25, 2016 at 5:19 PM
Hello,
for your information, I implemented this in the next version and it should be available soon (let's say within 1 month).
thanks,
Yvan
Coordinator
Mar 29, 2016 at 4:08 PM
Hello,
for your information, the update is available :)
You want to override FillPermissions in your inherited class to change / remove permissions created by LDAPCP, or add new ones.
Please let me know if you have some feedback or experience any issue.
Thanks,
Yvan
Marked as answer by Yvand on 3/24/2017 at 3:02 AM
Apr 4, 2016 at 6:18 PM
Great!!! I will go ahead and download the update this evening and test it out.

Thank you once again for implementing this and making it available quicker than I expected. Very thankful for all your efforts on this, Yvan.
Coordinator
Apr 5, 2016 at 12:34 PM
Thank you for your great feedback!
Please let me know if you have any issue, and feel free to rate the project (from the homepage) to show your satisfaction about it :)
Mar 23 at 3:31 PM
Hello

I am interresting too by this features, I don't find it in the last version, How use it ?

thx
Coordinator
Mar 24 at 11:03 AM
Hello, it's already available and you can implement this as described in my post above from Mar 29, 2016 (I just marked it as answer).