Exemplo n.º 1
0
        public PowerShellResults <RetentionPolicyTagRow> GetList(AllAssociatedRPTsFilter filter, SortOptions sort)
        {
            filter.IncludeDefaultTags = true;
            PowerShellResults <RetentionPolicyTagRow> list = base.GetList <RetentionPolicyTagRow, AllAssociatedRPTsFilter>("Get-RetentionPolicyTag", filter, null);
            PowerShellResults <RetentionPolicyTagRow> powerShellResults = list.MergeErrors <RetentionPolicyTagRow>(base.GetList <RetentionPolicyTagRow, OptInRPTsFilter>("Get-RetentionPolicyTag", new OptInRPTsFilter(), null));

            if (list.Succeeded && RbacPrincipal.Current.ExecutingUserId != null)
            {
                Accounts accounts = new Accounts();
                if (!RetentionUtils.UserHasArchive(accounts.GetRecipientObject(null)))
                {
                    List <RetentionPolicyTagRow> list2 = new List <RetentionPolicyTagRow>();
                    foreach (RetentionPolicyTagRow retentionPolicyTagRow in list.Output)
                    {
                        if (retentionPolicyTagRow.RetentionPolicyTag.RetentionAction != RetentionActionType.MoveToArchive)
                        {
                            list2.Add(retentionPolicyTagRow);
                        }
                    }
                    list.Output = list2.ToArray();
                }
            }
            if (list.Succeeded && powerShellResults.Succeeded)
            {
                foreach (RetentionPolicyTagRow retentionPolicyTagRow2 in list.Output.Intersect(powerShellResults.Output))
                {
                    retentionPolicyTagRow2.OptionalTag = true;
                }
                if (sort != null)
                {
                    sort.PropertyName = RetentionPolicyTagBaseRow.GetSortProperty(sort.PropertyName);
                    Func <RetentionPolicyTagRow[], RetentionPolicyTagRow[]> sortFunction = sort.GetSortFunction <RetentionPolicyTagRow>();
                    if (sortFunction != null)
                    {
                        list.Output = sortFunction(list.Output);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public PowerShellResults <OptionalRetentionPolicyTagRow> GetList(AllRPTsFilter filter, SortOptions sort)
        {
            PowerShellResults <OptionalRetentionPolicyTagRow> powerShellResults = new PowerShellResults <OptionalRetentionPolicyTagRow>();
            PowerShellResults <OptionalRetentionPolicyTagRow> list = base.GetList <OptionalRetentionPolicyTagRow, AllRPTsFilter>("Get-RetentionPolicyTag", filter, sort, "DisplayName");
            PowerShellResults <OptionalRetentionPolicyTagRow> powerShellResults2 = list.MergeErrors <OptionalRetentionPolicyTagRow>(base.GetList <OptionalRetentionPolicyTagRow, AllAssociatedRPTsFilter>("Get-RetentionPolicyTag", new AllAssociatedRPTsFilter(), null));

            if (list.Succeeded && powerShellResults2.Succeeded)
            {
                powerShellResults.Output = list.Output.Except(powerShellResults2.Output).ToArray <OptionalRetentionPolicyTagRow>();
                if (RbacPrincipal.Current.ExecutingUserId != null)
                {
                    Accounts accounts = new Accounts();
                    if (!RetentionUtils.UserHasArchive(accounts.GetRecipientObject(null)))
                    {
                        List <OptionalRetentionPolicyTagRow> list2 = new List <OptionalRetentionPolicyTagRow>();
                        foreach (OptionalRetentionPolicyTagRow optionalRetentionPolicyTagRow in powerShellResults.Output)
                        {
                            if (optionalRetentionPolicyTagRow.RetentionPolicyTag.RetentionAction != RetentionActionType.MoveToArchive)
                            {
                                list2.Add(optionalRetentionPolicyTagRow);
                            }
                        }
                        powerShellResults.Output = list2.ToArray();
                    }
                }
                if (sort != null)
                {
                    sort.PropertyName = RetentionPolicyTagBaseRow.GetSortProperty(sort.PropertyName);
                    Func <OptionalRetentionPolicyTagRow[], OptionalRetentionPolicyTagRow[]> sortFunction = sort.GetSortFunction <OptionalRetentionPolicyTagRow>();
                    if (sortFunction != null)
                    {
                        powerShellResults.Output = sortFunction(powerShellResults.Output);
                    }
                }
            }
            return(powerShellResults);
        }