Пример #1
0
 protected void LogDebugSearchTree(Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
 {
     UPSClaimProviderLogger.LogDebug($"Writing to log SPProviderHierarchyTree:");
     UPSClaimProviderLogger.LogDebug($"searchTree.Name: {searchTree.Name}");
     UPSClaimProviderLogger.LogDebug($"searchTree.ProviderName: {searchTree.ProviderName}");
     UPSClaimProviderLogger.LogDebug($"searchTree.IsRoot: {searchTree.IsRoot}");
     UPSClaimProviderLogger.LogDebug($"searchTree.IsLeaf: {searchTree.IsLeaf}");
     UPSClaimProviderLogger.LogDebug($"searchTree.HierarchyNodeID: {searchTree.HierarchyNodeID}");
     UPSClaimProviderLogger.LogDebug($"searchTree.HasChildren: {searchTree.HasChildren}");
     UPSClaimProviderLogger.LogDebug($"searchTree.Count: {searchTree.Count}");
 }
Пример #2
0
        protected override void FillSearch(Uri context, string[] entityTypes,
                                           string searchPattern, string hierarchyNodeID, int maxCount,
                                           Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
        {
            if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole) &&
                !EntityTypesContain(entityTypes, SPClaimEntityTypes.User))
            {
                return;
            }

            List <ADFSUser> users = ADFSHelper.Search(searchPattern);

            foreach (var user in users)
            {
                PickerEntity entity = GetPickerEntity(user);
                searchTree.AddEntity(entity);
            }
        }
        protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
        {
            List <DBUser> users = DBHelper.Search(searchPattern);

            foreach (var user in users)
            {
                PickerEntity entity = GetPickerEntity(user);
                searchTree.AddEntity(entity);
            }
        }
Пример #4
0
        protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
        {
            UPSClaimProviderLogger.LogDebug("FillSearch invoked!");

            LogDebugSearchTree(searchTree);

            string outputString;

            outputString = $"searchPattern: {searchPattern}, hierarchyNodeID: {hierarchyNodeID}, maxCount: {maxCount}";
            UPSClaimProviderLogger.LogDebug(outputString);

            List <User> foundUsers = usersDAL.GetUsersBySearchPattern(searchPattern);

            if (foundUsers.Count > 0)
            {
                UPSClaimProviderLogger.LogDebug($"Count of users found: {foundUsers.Count}");

                foundUsers.ForEach((foundUser) =>
                {
                    PickerEntity entity = GetPickerEntity(foundUser);
                    searchTree.AddEntity(entity);
                    UPSClaimProviderLogger.LogDebug($"Added PickerEntity with Claim -  Claim.Value: {entity.Claim.Value}, Claim.ClaimType: {entity.Claim.ClaimType}, Claim.OriginalIssuer: {entity.Claim.OriginalIssuer}");
                });
            }
            else if (foundUsers.Count == 0)
            {
                UPSClaimProviderLogger.LogDebug("No users found");
            }
            ;
        }
Пример #5
0
        protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree hierarchy)
        {
            if (!entityTypes.Contains(SPClaimEntityTypes.Trusted))
            {
                return;
            }

            if (hierarchyNodeID == null)
            {
                foreach (var filter in filters)
                {
                    hierarchy.AddChild(new Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(
                                           ProviderInternalName,
                                           filter.Value,
                                           filter.Key,
                                           true));
                }
            }
        }
Пример #6
0
        protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
        {
            if (!entityTypes.Contains(SPClaimEntityTypes.Trusted))
            {
                return;
            }

            var organizationMatches = SearchOrganizations(searchPattern);

            if (organizationMatches.Count() > 0)
            {
                var matchNode = new SPProviderHierarchyNode(
                    ProviderInternalName,
                    filters[OrganizationKey],
                    OrganizationKey,
                    true);
                searchTree.AddChild(matchNode);

                foreach (var match in organizationMatches)
                {
                    PickerEntity pe = GetPickerEntity(match, OrganizationClaimType, filters[OrganizationKey]);
                    matchNode.AddEntity(pe);
                }
            }

            var roleMatches = SearchRoles(searchPattern);

            if (roleMatches.Count() > 0)
            {
                var matchNode = new SPProviderHierarchyNode(
                    ProviderInternalName,
                    filters[RoleKey],
                    RoleKey,
                    true);
                searchTree.AddChild(matchNode);

                foreach (var match in roleMatches)
                {
                    PickerEntity pe = GetPickerEntity(match, Microsoft.IdentityModel.Claims.ClaimTypes.Role, filters[RoleKey]);
                    matchNode.AddEntity(pe);
                }
            }
        }
        protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
        {
            //Make sure search is asking for the type of entity we return; site collection admin won't for example.
            if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole))
            {
                return;
            }

            //Counter to track what node we are in.
            int teamNode = -1;

            //Nodes where we will stick our matches.
            Microsoft.SharePoint.WebControls.SPProviderHierarchyNode matchNode = null;

            //Look to see if the value that is typed in matches any of our teams.
            foreach (string team in ourTeams)
            {
                //Increment team node tracker.
                teamNode += 1;

                if (team.ToLower().StartsWith(searchPattern.ToLower()))
                {
                    //We have a match, create a matching entity.
                    PickerEntity pe = GetPickerEntity(team);

                    //Add the team node where it should be displayed too.
                    if (!searchTree.HasChild(teamKeys[teamNode]))
                    {
                        //Create the node so we can show our match in there too.
                        matchNode = new
                                    SPProviderHierarchyNode(SqlClaims.ProviderInternalName,
                                                            teamLabels[teamNode],
                                                            teamKeys[teamNode],
                                                            true);

                        //Add it to the tree.
                        searchTree.AddChild(matchNode);
                    }
                    else
                    {
                        //Get the node for this team.
                        matchNode = searchTree.Children.Where(theNode =>
                                                              theNode.HierarchyNodeID == teamKeys[teamNode]).First();
                    }

                    //Add the match to our node.
                    matchNode.AddEntity(pe);
                }
            }
        }
        protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree hierarchy)
        {
            //Make sure picker is asking for the type of entity we return; site collection admin won't for example.
            if (!EntityTypesContain(entityTypes, SPClaimEntityTypes.FormsRole))
            {
                return;
            }

            //Check to see if the hierarchyNodeID is null; it will be when the control
            //is first loaded but if a user clicks on one of the nodes it will return
            //the key of the node that was clicked.
            switch (hierarchyNodeID)
            {
            case null:
                //When it first loads add all our nodes.
                hierarchy.AddChild(new
                                   Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(
                                       SqlClaims.ProviderInternalName,
                                       teamLabels[0],
                                       teamKeys[0],
                                       true));

                hierarchy.AddChild(new
                                   Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(
                                       SqlClaims.ProviderInternalName,
                                       teamLabels[1],
                                       teamKeys[1],
                                       true));

                hierarchy.AddChild(new
                                   Microsoft.SharePoint.WebControls.SPProviderHierarchyNode(
                                       SqlClaims.ProviderInternalName,
                                       teamLabels[2],
                                       teamKeys[2],
                                       true));
                break;

            default:
                break;
            }
        }
Пример #9
0
 protected override void FillSearch(Uri context, string[] entityTypes, string searchPattern, string hierarchyNodeID, int maxCount, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree searchTree)
 {
     //SPProviderHierarchyNode matchNode = null;
     //throw new NotImplementedException();
 }
Пример #10
0
 protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree hierarchy)
 {
     hierarchy.AddChild(new Microsoft.SharePoint.WebControls.SPProviderHierarchyNode("ZimbraClaimProvider", "Users", "Users", true));
 }
 protected override void FillHierarchy(Uri context, string[] entityTypes, string hierarchyNodeID, int numberOfLevels, Microsoft.SharePoint.WebControls.SPProviderHierarchyTree hierarchy)
 {
     throw new NotImplementedException();
 }