This project has moved and is read-only. For the latest updates, please go here.

How to keep admin pages while customizing ldapcp?

Dec 7, 2016 at 1:50 PM
Edited Dec 12, 2016 at 1:51 PM
Hello,

Is it possible to keep admin pages while customizing ldapcp?

I mean when using custom version of ldapcp the admin pages are no longer there, we need those admin pages to customize the display in the people picker... eg displaying only Display Names for example.

Kind regards.
Claude
Dec 12, 2016 at 2:35 PM
Hello,
with the latest version I moved the admin pages into user controls, so it should be fairly simple to do but I never tried...
If you want to give it a try, you can create a page that adds user controls in markup code, and sets their properties in code behind of the page.
thanks,
Yvan
Dec 12, 2016 at 5:23 PM
Thank you for your answer. In fact I just need to make the people picker displays the 'User display name'.

Could you be kind enough to show me how to modify the custom code following (downloaded from this site) to achieve this?
        protected override void SetCustomConfiguration(Uri context, string[] entityTypes)
        {
            //base.SetCustomConfiguration( context, entityTypes);

            this.CurrentConfiguration.FilterEnabledUsersOnlyProp = true;
            this.CurrentConfiguration.FilterSecurityGroupsOnlyProp = true;
            this.CurrentConfiguration.FilterExactMatchOnlyProp = false;

            // If input is resolved by an attribute linked to identity claim type (typically displayName and cn attributes), show its value in parenthesis.
            this.CurrentConfiguration.DisplayLdapMatchForIdentityClaimTypeProp = false;

            // By default LDAPCP matches LDAP attributes with claim types as documented in homepage of project
            // But you can customize this mapping to match claim types defined in (Get-SPTrustedIdentityTokenIssuer).ClaimTypeInformation
            this.CurrentConfiguration.AttributesListProp = new List<AttributeHelper>
            {
                new AttributeHelper{LDAPAttribute="mail", LDAPObjectClassProp="user", ClaimType=WIF.ClaimTypes.Email, ClaimEntityType = SPClaimEntityTypes.User, EntityDataKey=PeopleEditorEntityDataKeys.Email,LDAPAttributeToDisplayProp="DisplayName"},
                new AttributeHelper{LDAPAttribute="sAMAccountName", LDAPObjectClassProp="user", ClaimType=WIF.ClaimTypes.WindowsAccountName, ClaimEntityType = SPClaimEntityTypes.User, AdditionalLDAPFilterProp="(!(objectClass=computer))",LDAPAttributeToDisplayProp="DisplayName"},
                new AttributeHelper{LDAPAttribute="userPrincipalName", LDAPObjectClassProp="user", ClaimType=WIF.ClaimTypes.Upn, ClaimEntityType = SPClaimEntityTypes.User,LDAPAttributeToDisplayProp="DisplayName"},
                new AttributeHelper{LDAPAttribute="sAMAccountName", LDAPObjectClassProp="group", ClaimType=WIF.ClaimTypes.Role, ClaimEntityType = SPClaimEntityTypes.FormsRole,LDAPAttributeToDisplayProp="DisplayName"},

                // Items below (CreateAsIdentityClaim=true) will always be queried and permission will be created using identity claim type
                // This allows to search user on common attributes such as the firstname / lastname / displayname, etc...
                new AttributeHelper{LDAPAttribute="displayName", LDAPObjectClassProp="user", CreateAsIdentityClaim=true, EntityDataKey=PeopleEditorEntityDataKeys.DisplayName,LDAPAttributeToDisplayProp="DisplayName"},
                new AttributeHelper{LDAPAttribute="cn", LDAPObjectClassProp="user", CreateAsIdentityClaim=true, AdditionalLDAPFilterProp="(!(objectClass=computer))",LDAPAttributeToDisplayProp="DisplayName"},
                new AttributeHelper{LDAPAttribute="sn", LDAPObjectClassProp="user", CreateAsIdentityClaim=true,LDAPAttributeToDisplayProp="DisplayName"},

                // items below don't have a claim type or CreateAsIdentityClaim set, so they do not participate in LDAP query, but they are retrieved (if they exist) to populate metadata (PeopleEditorEntityDataKeys) of the permission (PickerEntity)
                new AttributeHelper{LDAPAttribute="department", LDAPObjectClassProp="user", EntityDataKey=PeopleEditorEntityDataKeys.Department,LDAPAttributeToDisplayProp="DisplayName"},
                new AttributeHelper{LDAPAttribute="title", LDAPObjectClassProp="user", EntityDataKey=PeopleEditorEntityDataKeys.JobTitle,LDAPAttributeToDisplayProp="DisplayName"},
            };
        }
Dec 13, 2016 at 12:20 PM
Edited Dec 13, 2016 at 12:22 PM
Then you can type just this in the method;
this.CurrentConfiguration.AttributesListProp = new List<AttributeHelper>
{
    new AttributeHelper{LDAPAttribute="userPrincipalName", LDAPObjectClassProp="user", ClaimType=WIF.ClaimTypes.Upn, ClaimEntityType = SPClaimEntityTypes.User},
};
Well, of course you must replace WIF.ClaimTypes.Upn with the actual identity claim type set in the trust.
Dec 13, 2016 at 4:02 PM
Thank you, you mean to have just the code below in the "SetCustomConfiguration" method?
protected override void SetCustomConfiguration(Uri context, string[] entityTypes)
{
   this.CurrentConfiguration.AttributesListProp = new List<AttributeHelper>
   {
       new AttributeHelper{LDAPAttribute="userPrincipalName", LDAPObjectClassProp="user", ClaimType=WIF.ClaimTypes.Upn, ClaimEntityType = SPClaimEntityTypes.User},
   };
}
Thank you
Claude
Dec 14, 2016 at 11:35 AM
Edited Dec 14, 2016 at 12:00 PM
Hello Yvand,

I did it and what is displayed is not the display name but the upn. How can I manage to only show the Display name in the picker when users are proposed to be picked up?

I tried something like below without success...still the upn is showed...

new AttributeHelper{LDAPAttributeToDisplayProp="displayName" }

Kind regards.
Claude
Dec 14, 2016 at 12:23 PM
Hello,
you just need to set property LDAPAttributeToDisplayProp like this:
protected override void SetCustomConfiguration(Uri context, string[] entityTypes)
{
   this.CurrentConfiguration.AttributesListProp = new List<AttributeHelper>
   {
       new AttributeHelper{LDAPAttribute="userPrincipalName", LDAPObjectClassProp="user", ClaimType=WIF.ClaimTypes.Upn, ClaimEntityType = SPClaimEntityTypes.User, LDAPAttributeToDisplayProp="DisplayName"},
   };
}
Marked as answer by csiefers on 12/14/2016 at 8:59 AM
Dec 14, 2016 at 4:58 PM
It works!

Thank you very very very much Yvand.

Kind regards.
Claude
Jan 2 at 10:12 AM
Edited Jan 2 at 10:14 AM
Hello and Beste wishes for the new year to all.

A remaining question about the display of the results.
Is there a way to display not only the dispay name of the found users but to add too the name of the AD group they belongs to?
Kind regards.
Claude