Example #1
0
        public PowerShellResults <Account> GetObject(Identity identity)
        {
            bool flag = identity != null;

            identity = (identity ?? Identity.FromExecutingUserId());
            PowerShellResults <Account> @object = base.GetObject <Account>("Get-Mailbox", identity);

            if (@object.SucceededWithValue)
            {
                @object.Value.IsProfilePage = this.IsProfilePage;
                PowerShellResults <User> powerShellResults = @object.MergeErrors <User>(base.GetObject <User>("Get-User", identity));
                if (powerShellResults.SucceededWithValue)
                {
                    @object.Value.OrgPersonObject = powerShellResults.Value;
                    if (RbacPrincipal.Current.IsInRole("MultiTenant+Mailbox+Get-MailboxStatistics?Identity@R:Organization") || (this.IsProfilePage && RbacPrincipal.Current.IsInRole("Mailbox+Get-MailboxStatistics?Identity@R:Self")))
                    {
                        PowerShellResults <MailboxStatistics> object2 = base.GetObject <MailboxStatistics>("Get-MailboxStatistics", identity, false);
                        if (object2.SucceededWithValue)
                        {
                            @object.Value.Statistics = object2.Value;
                        }
                    }
                    if (@object.Value.IsRoom && RbacPrincipal.Current.IsInRole("Get-CalendarProcessing?Identity@R:Organization"))
                    {
                        PowerShellResults <CalendarConfiguration> powerShellResults2 = @object.MergeErrors <CalendarConfiguration>(base.GetObject <CalendarConfiguration>("Get-CalendarProcessing", identity, false));
                        if (powerShellResults2.SucceededWithValue)
                        {
                            @object.Value.CalendarConfiguration = powerShellResults2.Value;
                        }
                    }
                    if (RbacPrincipal.Current.IsInRole("Get-SupervisionListEntry?Identity@R:Organization"))
                    {
                        SupervisionListEntryFilter filter = new SupervisionListEntryFilter
                        {
                            Identity = identity,
                            Tag      = null
                        };
                        PowerShellResults <SupervisionListEntryRow> powerShellResults3 = @object.MergeErrors <SupervisionListEntryRow>(base.GetList <SupervisionListEntryRow, SupervisionListEntryFilter>("Get-SupervisionListEntry", filter, null));
                        if (powerShellResults3.Succeeded)
                        {
                            @object.Value.AllowedSenders = this.GetStringsWithTag(powerShellResults3.Output, "allow");
                            @object.Value.BlockedSenders = this.GetStringsWithTag(powerShellResults3.Output, "reject");
                        }
                    }
                }
                if (RbacPrincipal.Current.IsInRole("Get-CasMailbox?Identity@R:Organization") || (!flag && RbacPrincipal.Current.IsInRole("Get-CasMailbox?Identity@R:Self")))
                {
                    PowerShellResults <CASMailbox> powerShellResults4 = @object.MergeErrors <CASMailbox>(base.GetObject <CASMailbox>("Get-CasMailbox", identity, false));
                    if (powerShellResults4.SucceededWithValue)
                    {
                        @object.Value.CasMailbox = powerShellResults4.Value;
                    }
                }
            }
            return(@object);
        }
Example #2
0
        private PowerShellResults <MailboxRecipientRow> UpdateSupervisionBlockAllowLists(Identity identity, SetAccount properties, PowerShellResults <MailboxRecipientRow> results)
        {
            if (properties.AllowedSenders == null && properties.BlockedSenders == null)
            {
                return(results);
            }
            SupervisionListEntryFilter filter = new SupervisionListEntryFilter
            {
                Identity = identity,
                Tag      = null
            };
            PowerShellResults <SupervisionListEntryRow> powerShellResults = results.MergeErrors <SupervisionListEntryRow>(base.GetList <SupervisionListEntryRow, SupervisionListEntryFilter>("Get-SupervisionListEntry", filter, null));

            if (powerShellResults.Succeeded)
            {
                if (properties.AllowedSenders != null)
                {
                    IEnumerable <string> stringsWithTag = this.GetStringsWithTag(powerShellResults.Output, "allow");
                    results = this.UpdateSupervisionListForTag(identity, results, stringsWithTag, properties.AllowedSenders, "allow");
                    if (results.Failed)
                    {
                        return(results);
                    }
                }
                if (properties.BlockedSenders != null)
                {
                    IEnumerable <string> stringsWithTag2 = this.GetStringsWithTag(powerShellResults.Output, "reject");
                    results = this.UpdateSupervisionListForTag(identity, results, stringsWithTag2, properties.BlockedSenders, "reject");
                    if (results.Failed)
                    {
                        return(results);
                    }
                }
            }
            return(results);
        }