protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, SPProviderHierarchyTree searchTree)
        {
            if (!this.SetSPTrustInCurrentContext(context))
            {
                return;
            }

            SPProviderHierarchyNode matchNode = null;

            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                this.InitializeAuth0Client();
                var consolidatedResults = this.ResolveInputBulk(searchPattern, hierarchyNodeID);

                if (consolidatedResults != null)
                {
                    if (string.IsNullOrEmpty(searchPattern))
                    {
                        // All users from specific connection(s)
                        var results = this.CreateAllUsersResults(hierarchyNodeID);
                        results.ToList().ForEach(
                            r => consolidatedResults.Add(r));
                    }
                    else if (this.alwaysResolveValue &&
                             Utils.ValidEmail(searchPattern) &&
                             !consolidatedResults.Any(
                                 r => r.Auth0User.Email.Equals(searchPattern, StringComparison.OrdinalIgnoreCase) &&
                                 r.Attribute.PeoplePickerAttributeHierarchyNodeId == hierarchyNodeID))
                    {
                        // Specific email from specific connection
                        var result = this.CreateUniqueResult(searchPattern, UsersNode);
                        consolidatedResults.Add(result);
                    }

                    if (consolidatedResults.Count > 0)
                    {
                        foreach (var consolidatedResult in consolidatedResults)
                        {
                            // Add current PickerEntity to the corresponding attribute in the hierarchy
                            if (!searchTree.HasChild(UsersNode))
                            {
                                matchNode = new SPProviderHierarchyNode(
                                    ProviderInternalName,
                                    consolidatedResult.Attribute.PeoplePickerAttributeDisplayName,
                                    consolidatedResult.Attribute.PeoplePickerAttributeHierarchyNodeId,
                                    true);

                                searchTree.AddChild(matchNode);
                            }

                            matchNode.AddEntity(consolidatedResult.PickerEntity);
                        }

                        return;
                    }
                }
            });
        }
Пример #2
0
        protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, SPProviderHierarchyTree hierarchy)
        {
            if (!this.SetLoginProviderForCurrentContext(context))
            {
                return;
            }

            hierarchy.AddChild(new
                               Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(ProviderInternalName, UsersNode, UsersNode, true));
        }
        protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, SPProviderHierarchyTree searchTree)
        {
            if (!this.SetSPTrustInCurrentContext(context))
            {
                return;
            }

            SPProviderHierarchyNode matchNode = null;
            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                this.InitializeAuth0Client();
                var consolidatedResults = this.ResolveInputBulk(searchPattern, hierarchyNodeID);

                if (consolidatedResults != null)
                {
                    if (string.IsNullOrEmpty(searchPattern))
                    {
                        // All users from specific connection(s)
                        var results = this.CreateAllUsersResults(hierarchyNodeID);
                        results.ToList().ForEach(
                            r => consolidatedResults.Add(r));
                    }
                    else if (this.alwaysResolveValue &&
                             Utils.ValidEmail(searchPattern) &&
                             !consolidatedResults.Any(
                                r => r.Auth0User.Email.Equals(searchPattern, StringComparison.OrdinalIgnoreCase) &&
                                     r.Attribute.PeoplePickerAttributeHierarchyNodeId == hierarchyNodeID))
                    {
                        // Specific email from specific connection
                        var result = this.CreateUniqueResult(searchPattern, UsersNode);
                        consolidatedResults.Add(result);
                    }

                    if (consolidatedResults.Count > 0)
                    {
                        foreach (var consolidatedResult in consolidatedResults)
                        {
                            // Add current PickerEntity to the corresponding attribute in the hierarchy
                            if (!searchTree.HasChild(UsersNode))
                            {
                                matchNode = new SPProviderHierarchyNode(
                                    ProviderInternalName,
                                    consolidatedResult.Attribute.PeoplePickerAttributeDisplayName,
                                    consolidatedResult.Attribute.PeoplePickerAttributeHierarchyNodeId,
                                    true);

                                searchTree.AddChild(matchNode);
                            }

                            matchNode.AddEntity(consolidatedResult.PickerEntity);
                        }

                        return;
                    }
                }
            });
        }
        protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, SPProviderHierarchyTree hierarchy)
        {
            if (!this.SetSPTrustInCurrentContext(context))
            {
                return;
            }

            hierarchy.AddChild(new
                    Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(
                        ProviderInternalName, UsersNode, UsersNode, true));
        }
        //provides the People Picker control with the ability to load portions of 
        //the[T:HYPERLINK"ms-help://MS.SPF14SDK.en/SPF14MrefControls/html/a4bf54d0-29e5-e5c2-231e-b1b9f4728a7f.htm
        //"Microsoft.SharePoint.WebControls.SPProviderHierarchyTree] tree from the claims provider and specifies the hierarchy for displaying the picker entities.
        protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, SPProviderHierarchyTree hierarchy)
        {
            if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole))
            {
                return;
            }
            if (hierarchyNodeID == null)
            {
                int numberOfKeys = clearanceKeys.Length;
                for (int i = 0; i < numberOfKeys; i++)
                {
                    hierarchy.AddChild(
                        new Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(
                            SecurityClearanceCP.ProviderInternalName,
                            clearanceLabels[i],
                            clearanceKeys[i],
                            true


                   ));
                }
            }
        }