public static ADFSUser SearchExact(string pattern, ADFSUsers users)
        {
            ADFSUser[] allUsers     = users.Items;
            ADFSUser   filteredUser = (from u in allUsers
                                       where u.SearchableTerms.Contains(pattern)
                                       select u).FirstOrDefault();

            return(filteredUser);
        }
        public static ADFSUser FindExact(string pattern)
        {
            ADFSUser user = null;

            //Run with elevated privileges to get the context of the service account
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                user = SearchExact(pattern, AllUsers);
            });
            return(user);
        }
Пример #3
0
        protected override void FillResolve(Uri context, string[] entityTypes,
                                            string resolveInput, List <Microsoft.SharePoint.WebControls.PickerEntity> resolved)
        {
            ADFSUser user = ADFSHelper.FindExact(resolveInput);

            if (null != user)
            {
                PickerEntity entity = GetPickerEntity(user);
                resolved.Add(entity);
            }
        }
Пример #4
0
        private PickerEntity GetPickerEntity(ADFSUser user)
        {
            PickerEntity entity = CreatePickerEntity();

            entity.Claim = new SPClaim(LDAPClaimType, user.ppl_email, LDAPClaimValueType,
                                       SPOriginalIssuers.Format(SPOriginalIssuerType.Forms, SPTrustedIdentityTokenIssuerName));

            entity.Description = user.ppl_id;
            entity.DisplayText = user.ppl_email;
            entity.EntityData[PeopleEditorEntityDataKeys.DisplayName] = user.ppl_email;
            entity.EntityData[PeopleEditorEntityDataKeys.Email]       = user.ppl_email;
            entity.EntityData[PeopleEditorEntityDataKeys.AccountName] = user.ppl_id;
            entity.EntityType = SPClaimEntityTypes.User;
            entity.IsResolved = true;
            return(entity);
        }