Ejemplo n.º 1
0
 private PowerShellResults <AdminRoleGroupRow> SetRoleAssignments(IEnumerable <Identity> unchangedRoles, ManagementRoleAssignments roleAssignmentsWebService, Identity identity, ManagementScopeRow scopeRow, ExtendedOrganizationalUnit ouRow, PowerShellResults <AdminRoleGroupRow> results)
 {
     if ((ouRow != null || scopeRow != null) && unchangedRoles != null)
     {
         foreach (Identity roleIdentity in unchangedRoles)
         {
             PowerShellResults <ManagementRoleAssignment> roleAssignments = this.GetRoleAssignments(roleIdentity, identity, roleAssignmentsWebService);
             if (roleAssignments.Failed)
             {
                 results.MergeErrors <ManagementRoleAssignment>(roleAssignments);
                 return(results);
             }
             SetManagementRoleAssignment properties = this.SetScopeInfoInParameter(roleIdentity, null, scopeRow, ouRow, results);
             if (results.Failed)
             {
                 return(results);
             }
             ManagementRoleAssignment[] output = roleAssignments.Output;
             foreach (ManagementRoleAssignment managementRoleAssignment in output)
             {
                 if (managementRoleAssignment.DelegationType == RoleAssignmentDelegationType.Regular)
                 {
                     results.MergeErrors <ManagementRoleAssignment>(roleAssignmentsWebService.SetObject(managementRoleAssignment.Identity, properties));
                     if (results.Failed)
                     {
                         return(results);
                     }
                 }
             }
         }
         return(results);
     }
     return(results);
 }
Ejemplo n.º 2
0
        public PowerShellResults <DeviceClassPickerObject> GetList(DeviceClassPickerFilter filter, SortOptions sort)
        {
            if (!string.IsNullOrEmpty(filter.DeviceType))
            {
                filter.Filter = string.Format("DeviceType -eq '{0}'", filter.DeviceType);
            }
            PowerShellResults <DeviceClassPickerObject> list = base.GetList <DeviceClassPickerObject, DeviceClassPickerFilter>("Get-ActiveSyncDeviceClass", filter, sort);

            if (filter.GroupDeviceType)
            {
                List <DeviceClassPickerObject> list2 = new List <DeviceClassPickerObject>();
                list2.Add(new DeviceClassPickerObject(DeviceClassPickerObject.AllDeviceTypeQueryString, DeviceClassPickerObject.AllDeviceModelQueryString));
                HashSet <string> hashSet = new HashSet <string>();
                foreach (DeviceClassPickerObject deviceClassPickerObject in list.Output)
                {
                    if (!hashSet.Contains(deviceClassPickerObject.DeviceType.QueryString))
                    {
                        list2.Add(deviceClassPickerObject);
                        hashSet.Add(deviceClassPickerObject.DeviceType.QueryString);
                    }
                }
                list.Output = list2.ToArray();
            }
            else if (!string.IsNullOrEmpty(filter.DeviceType))
            {
                List <DeviceClassPickerObject> list3 = new List <DeviceClassPickerObject>();
                list3.Add(new DeviceClassPickerObject(new DeviceAccessRuleQueryString
                {
                    QueryString = filter.DeviceType
                }, DeviceClassPickerObject.AllDeviceModelQueryString));
                list3.AddRange(list.Output);
                list.Output = list3.ToArray();
            }
            return(list);
        }
Ejemplo n.º 3
0
        public PowerShellResults <EndUserRoleRow> GetAssignedEndUserRoles(RoleAssignmentPolicyFilter filter, SortOptions sort)
        {
            PowerShellResults <RoleAssignmentPolicy> @object           = this.GetObject(filter.Policy);
            PowerShellResults <EndUserRoleRow>       powerShellResults = new PowerShellResults <EndUserRoleRow>
            {
                ErrorRecords = @object.ErrorRecords,
                Warnings     = @object.Warnings
            };

            if (@object.SucceededWithValue)
            {
                EndUserRoles endUserRoles = new EndUserRoles();
                powerShellResults.MergeAll(endUserRoles.GetList(null, null));
                if (powerShellResults.Succeeded)
                {
                    List <EndUserRoleRow> list = new List <EndUserRoleRow>();
                    foreach (EndUserRoleRow endUserRoleRow in powerShellResults.Output)
                    {
                        if (@object.Value.AssignedEndUserRoles.Contains(endUserRoleRow.Identity))
                        {
                            list.Add(endUserRoleRow);
                        }
                    }
                    powerShellResults.Output = list.ToArray();
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 4
0
        protected override void OnLoad(EventArgs e)
        {
            WebServiceReference webServiceReference = new WebServiceReference("~/DDI/DDIService.svc?schema=DisconnectedMailbox&workflow=GetServerDropDown");

            try
            {
                PowerShellResults <JsonDictionary <object> > list = webServiceReference.GetList(null, null);
                if (list.Output != null && list.Output.Length > 0)
                {
                    Microsoft.Exchange.Management.ControlPanel.WebControls.ListView listView = (Microsoft.Exchange.Management.ControlPanel.WebControls.ListView) this.FindControl("disconnectedMailboxListView");
                    listView.Views = new List <ListItem>();
                    JsonDictionary <object>[] output = list.Output;
                    for (int i = 0; i < output.Length; i++)
                    {
                        Dictionary <string, object> dictionary = output[i];
                        listView.Views.Add(new ListItem((string)dictionary["Name"], (string)dictionary["Name"]));
                    }
                    listView.Views.Sort((ListItem item1, ListItem item2) => item1.Text.CompareTo(item2.Text));
                }
            }
            catch (TargetInvocationException ex)
            {
                throw ex.InnerException;
            }
            base.OnLoad(e);
        }
Ejemplo n.º 5
0
 private void DisplayResults <T>(PowerShellResults <T> results) where T : PimSubscription
 {
     if (results.Failed)
     {
         if (results.ErrorRecords[0].Exception is ManagementObjectNotFoundException)
         {
             ErrorHandlingUtil.TransferToErrorPage("liveidmismatch");
             return;
         }
         if (results.ErrorRecords[0].Exception is ValidateSecretFailureException)
         {
             ErrorHandlingUtil.TransferToErrorPage("verificationfailed");
             return;
         }
         ErrorHandlingUtil.TransferToErrorPage("verificationprocessingerror");
         return;
     }
     else
     {
         if (results.Output.Length == 0)
         {
             ErrorHandlingUtil.TransferToErrorPage("verificationprocessingerror");
             return;
         }
         this.msgText.Text = OwaOptionStrings.VerificationSuccessText(results.Output[0].EmailAddress);
         base.Title        = OwaOptionStrings.VerificationSuccessPageTitle;
         return;
     }
 }
Ejemplo n.º 6
0
        protected PowerShellResults ChangePriority <T>(Identity[] identities, int offset, WebServiceParameters parameters) where T : RuleRow
        {
            identities.FaultIfNotExactlyOne();
            PowerShellResults <T> @object = base.GetObject <T>("Get-" + this.TaskNoun, identities[0]);

            if (@object.Failed)
            {
                return(@object);
            }
            int num = @object.Output[0].Priority + offset;

            if (num < 0)
            {
                return(new PowerShellResults());
            }
            PSCommand pscommand = new PSCommand().AddCommand("Set-" + this.TaskNoun);

            pscommand.AddParameter("Priority", num);
            PowerShellResults powerShellResults = base.Invoke(pscommand, identities, parameters);

            if (powerShellResults.ErrorRecords != null && powerShellResults.ErrorRecords.Length == 1 && powerShellResults.ErrorRecords[0].Exception is InvalidPriorityException)
            {
                powerShellResults.ErrorRecords = new ErrorRecord[0];
            }
            return(powerShellResults);
        }
Ejemplo n.º 7
0
        private PowerShellResults <T> CoreInvoke <T>(PSCommand psCommand, IEnumerable pipelineInput, Identity translationIdentity, WebServiceParameters parameters)
        {
            PowerShellResults <T> powerShellResults = psCommand.Invoke(this.runspaceMediator, pipelineInput, parameters);

            powerShellResults.TranslationIdentity = translationIdentity;
            return(powerShellResults);
        }
Ejemplo n.º 8
0
        public PowerShellResults BlockDevice(Identity[] identities, BaseWebServiceParameters parameters)
        {
            PowerShellResults powerShellResults = new PowerShellResults();

            foreach (Identity identity in identities)
            {
                PowerShellResults <MobileDevice> @object = base.GetObject <MobileDevice>("Get-MobileDevice", identity);
                powerShellResults.MergeErrors <MobileDevice>(@object);
                if (@object.HasValue)
                {
                    MobileDevice value     = @object.Value;
                    Identity     identity2 = value.Id.Parent.Parent.ToIdentity();
                    PowerShellResults <CASMailbox> object2 = base.GetObject <CASMailbox>("Get-CASMailbox", identity2);
                    powerShellResults.MergeErrors <CASMailbox>(object2);
                    if (object2.HasValue)
                    {
                        MultiValuedProperty <string> activeSyncBlockedDeviceIDs = object2.Value.ActiveSyncBlockedDeviceIDs;
                        if (!activeSyncBlockedDeviceIDs.Contains(value.DeviceId))
                        {
                            activeSyncBlockedDeviceIDs.Add(value.DeviceId);
                            PSCommand psCommand = new PSCommand().AddCommand("Set-CASMailbox").AddParameter("Identity", identity2).AddParameter("ActiveSyncBlockedDeviceIDs", activeSyncBlockedDeviceIDs);
                            powerShellResults.MergeErrors(base.Invoke(psCommand));
                        }
                    }
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 9
0
        protected override void RenderChanges()
        {
            PowerShellResults <AdminAuditLogDetailRow> powerShellResults = base.Results as PowerShellResults <AdminAuditLogDetailRow>;

            if (powerShellResults != null && powerShellResults.Output != null && powerShellResults.Succeeded && powerShellResults.Output.Length > 0)
            {
                Table table = new Table();
                int   num   = 0;
                while (num < powerShellResults.Output.Length && num < 500)
                {
                    AdminAuditLogDetailRow adminAuditLogDetailRow = powerShellResults.Output[num];
                    table.Rows.Add(base.GetDetailRowForTable(string.Format("<b>{0}</b>", Strings.AuditLogDateSDO)));
                    table.Rows.Add(base.GetDetailRowForTable(adminAuditLogDetailRow.AdminAuditLogEvent.RunDate.Value.ToUniversalTime().UtcToUserDateTimeString()));
                    table.Rows.Add(base.GetEmptyRowForTable());
                    table.Rows.Add(base.GetDetailRowForTable(string.Format("<b>{0}</b>", Strings.AuditLogUserSDO)));
                    table.Rows.Add(base.GetDetailRowForTable(adminAuditLogDetailRow.UserFriendlyCaller));
                    table.Rows.Add(base.GetEmptyRowForTable());
                    table.Rows.Add(base.GetDetailRowForTable(string.Format("<b>{0}</b>", Strings.AuditLogCmdletSDO)));
                    table.Rows.Add(base.GetDetailRowForTable(adminAuditLogDetailRow.AdminAuditLogEvent.CmdletName));
                    table.Rows.Add(base.GetEmptyRowForTable());
                    table.Rows.Add(base.GetDetailRowForTable(string.Format("<b>{0}</b>", Strings.AuditLogCmdletParameters)));
                    table.Rows.Add(base.GetDetailRowForTable(this.FormatParameters(adminAuditLogDetailRow.AdminAuditLogEvent.CmdletParameters)));
                    table.Rows.Add(base.GetEmptyRowForTable());
                    num++;
                }
                if (table.Rows.Count > 0)
                {
                    this.detailsPane.Controls.Add(table);
                    return;
                }
                table.Dispose();
            }
        }
Ejemplo n.º 10
0
 public PowerShellResults <SmsOptions> SetObject(Identity identity, SetSmsOptions properties)
 {
     properties.FaultIfNull();
     identity = Identity.FromExecutingUserId();
     if (!string.IsNullOrEmpty(properties.VerificationCode))
     {
         PSCommand pscommand = new PSCommand();
         pscommand.AddCommand("Compare-TextMessagingVerificationCode");
         pscommand.AddParameter("VerificationCode", properties.VerificationCode);
         PowerShellResults results = base.Invoke(pscommand, new Identity[]
         {
             identity
         }, new BaseWebServiceParameters
         {
             ShouldContinue = properties.ShouldContinue
         });
         PowerShellResults <SmsOptions> @object = this.GetObject(identity);
         @object.MergeErrors(results);
         return(@object);
     }
     if (!string.IsNullOrEmpty(properties.CountryCode) && !string.IsNullOrEmpty(properties.NotificationPhoneNumber) && !properties.NotificationPhoneNumber.StartsWith(properties.CountryCode))
     {
         properties.NotificationPhoneNumber = properties.CountryCode + properties.NotificationPhoneNumber;
     }
     return(base.SetObject <SmsOptions, SetSmsOptions>("Set-TextMessagingAccount", identity, properties));
 }
Ejemplo n.º 11
0
        public PowerShellResults <MailboxSearchRow> StartSearch(Identity[] identities, StartMailboxSearchParameters parameters)
        {
            List <Identity> list = new List <Identity>();

            if (parameters != null && parameters.Resume)
            {
                list.AddRange(identities);
            }
            else
            {
                foreach (Identity identity in identities)
                {
                    PowerShellResults <MailboxSearch> @object = base.GetObject <MailboxSearch>("Get-MailboxSearch", identity);
                    if (@object.Succeeded && @object.HasValue)
                    {
                        if ([email protected][0].IsEstimateOnly)
                        {
                            PSCommand pscommand = new PSCommand().AddCommand("Set-MailboxSearch");
                            pscommand.AddParameter("Identity", identity);
                            pscommand.AddParameter("EstimateOnly", true);
                            pscommand.AddParameter("ExcludeDuplicateMessages", false);
                            pscommand.AddParameter("LogLevel", LoggingLevel.Suppress);
                            pscommand.AddParameter("Force", true);
                            PowerShellResults powerShellResults = base.Invoke(pscommand);
                            if (!powerShellResults.Succeeded)
                            {
                                break;
                            }
                        }
                        list.Add(identity);
                    }
                }
            }
            return(base.InvokeAndGetObject <MailboxSearchRow>(new PSCommand().AddCommand("Start-MailboxSearch"), list.ToArray(), parameters));
        }
Ejemplo n.º 12
0
        internal override bool?IsInRoleCmdlet(ExchangeRunspaceConfiguration rbacConfiguration)
        {
            RbacQuery rbacQuery = new RbacQuery("Get-SupervisionPolicy");

            if (!rbacQuery.IsInRole(rbacConfiguration))
            {
                return(new bool?(false));
            }
            Supervision supervision = new Supervision();
            PowerShellResults <SupervisionStatus> @object = supervision.GetObject(null);

            if (@object.SucceededWithValue)
            {
                foreach (SupervisionStatus supervisionStatus in @object.Output)
                {
                    if (supervisionStatus.ClosedCampusPolicyEnabled)
                    {
                        return(new bool?(true));
                    }
                }
                return(new bool?(false));
            }
            base.LogCmdletError(@object, "ClosedCampus");
            return(null);
        }
Ejemplo n.º 13
0
        public PowerShellResults <PimSubscriptionRow> ResendImapVerificationEmail(Identity[] identities, BaseWebServiceParameters parameters)
        {
            identities.FaultIfNotExactlyOne();
            SetImapSubscription setImapSubscription = new SetImapSubscription();

            setImapSubscription.ResendVerification = true;
            PowerShellResults <PimSubscriptionRow> powerShellResults = base.SetObject <ImapSubscription, SetImapSubscription, PimSubscriptionRow>("Set-ImapSubscription", identities[0], setImapSubscription);

            if (powerShellResults.Succeeded)
            {
                ImapSubscriptions imapSubscriptions          = new ImapSubscriptions();
                PowerShellResults <ImapSubscription> @object = imapSubscriptions.GetObject(identities[0]);
                if ([email protected])
                {
                    throw new FaultException(OwaOptionStrings.SubscriptionProcessingError);
                }
                string verificationFeedbackString = @object.Output[0].VerificationFeedbackString;
                if (verificationFeedbackString != null)
                {
                    powerShellResults.Informations = new string[]
                    {
                        verificationFeedbackString
                    };
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 14
0
        public PowerShellResults JoinGroups(Identity[] identities)
        {
            identities.FaultIfNullOrEmpty();
            Identity          groupIdentityForTranslation = DistributionGroupServiceBase.GetGroupIdentityForTranslation(identities);
            PowerShellResults powerShellResults           = new PowerShellResults();
            int num  = 0;
            int num2 = -1;

            for (int i = 0; i < identities.Length; i++)
            {
                PSCommand         psCommand          = new PSCommand().AddCommand("Add-DistributionGroupMember").AddParameter("Identity", identities[i]);
                PowerShellResults powerShellResults2 = base.Invoke(psCommand, groupIdentityForTranslation, null);
                if (powerShellResults2.SucceededWithoutWarnings)
                {
                    num++;
                    if (num == 1)
                    {
                        num2 = i;
                    }
                }
                powerShellResults.MergeErrors(powerShellResults2);
            }
            if (num > 0)
            {
                string text = (num == 1) ? OwaOptionStrings.JoinDlSuccess(identities[num2].DisplayName) : ((num == identities.Length) ? OwaOptionStrings.JoinDlsSuccess(num) : OwaOptionStrings.JoinOtherDlsSuccess(num));
                powerShellResults.Informations = new string[]
                {
                    text
                };
            }
            return(powerShellResults);
        }
Ejemplo n.º 15
0
        public PowerShellResults <ManagementRoleRow> GetList(ManagementRoleFilter filter, SortOptions sort)
        {
            PowerShellResults <ManagementRoleRow> list = base.GetList <ManagementRoleRow, ManagementRoleFilter>("Get-ManagementRole", filter, sort, "Name");

            list.Output = Array.FindAll <ManagementRoleRow>(list.Output, (ManagementRoleRow x) => !x.IsEndUserRole);
            return(list);
        }
Ejemplo n.º 16
0
        private void SetAddExtensionUrl(PowerShellResults <SetUMMailboxConfiguration> result)
        {
            Section             section             = base.Sections["UMMailboxExtensionSection"];
            EcpCollectionEditor ecpCollectionEditor = (EcpCollectionEditor)section.FindControl("ceExtensions");

            ecpCollectionEditor.PickerFormUrl = EcpUrl.AppendQueryParameter(ecpCollectionEditor.PickerFormUrl, "dialPlanId", result.Value.DialPlanId);
        }
Ejemplo n.º 17
0
        public PowerShellResults ProcessRequest(HttpContext context)
        {
            Identity identity = Identity.FromIdParameter(context.Request.QueryString["Identity"]);
            string   text     = context.Request.QueryString["Name"];

            if (identity == null || string.IsNullOrEmpty(identity.RawIdentity))
            {
                throw new BadQueryParameterException("Identity");
            }
            if (string.IsNullOrEmpty(text))
            {
                throw new BadQueryParameterException("Name");
            }
            context.Response.ContentType = "text/csv";
            context.Response.AddHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\"", HttpUtility.UrlEncode(text)));
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary["CsvStream"] = context.Response.OutputStream;
            DDIParameters properties = new DDIParameters
            {
                Parameters = new JsonDictionary <object>(dictionary)
            };
            IDDIService       iddiservice       = (IDDIService) new WebServiceReference(EcpUrl.EcpVDirForStaticResource + "DDI/DDIService.svc?schema=MigrationReport&workflow=ExportMigrationReport").ServiceInstance;
            PowerShellResults powerShellResults = iddiservice.SingleObjectExecute(identity, properties);

            if (this.IsValidUserError(powerShellResults))
            {
                powerShellResults = new PowerShellResults();
            }
            return(powerShellResults);
        }
Ejemplo n.º 18
0
        private void SetDynamicLabels(PowerShellResults <SetUMMailboxConfiguration> result)
        {
            Section section = base.Sections["UMMailboxConfigurationSection"];
            Label   label   = (Label)section.FindControl("txtExtension_label");
            Label   label2  = (Label)section.FindControl("lblLockedOutStatusAction");

            if (result.Output[0].IsSipDialPlan)
            {
                label.Text = Strings.UMMailboxSipLabel;
            }
            else if (result.Output[0].IsE164DialPlan)
            {
                label.Text = Strings.UMMailboxE164Label;
            }
            else
            {
                label.Text = Strings.UMMailboxExtensionLabel;
            }
            if (result.Output[0].AccountLockedOut)
            {
                label2.Style["display"] = "inline";
                return;
            }
            label2.Style["display"] = "none";
        }
Ejemplo n.º 19
0
        protected PowerShellResults <L> SetObject <O, U, L>(string setCmdlet, Identity identity, U properties, Identity identityForGetCmdlet) where O : L where U : SetObjectProperties
        {
            EcpPerfCounters.WebServiceSetObject.Increment();
            identity.FaultIfNull();
            properties.FaultIfNull();
            PowerShellResults <L> powerShellResults = new PowerShellResults <L>();

            properties.IgnoreNullOrEmpty = false;
            if (properties.Any <KeyValuePair <string, object> >())
            {
                powerShellResults = this.CoreInvoke <L>(new PSCommand().AddCommand(setCmdlet), identity.ToPipelineInput(), identity, properties);
            }
            if (powerShellResults.Succeeded && null != identityForGetCmdlet)
            {
                PowerShellResults <L> powerShellResults2 = null;
                if (properties.ReturnObjectType == ReturnObjectTypes.Full && this is IGetObjectService <O> )
                {
                    IGetObjectService <O> getObjectService = this as IGetObjectService <O>;
                    PowerShellResults <O> @object          = getObjectService.GetObject(identityForGetCmdlet);
                    powerShellResults2 = new PowerShellResults <L>();
                    powerShellResults2.MergeOutput(@object.Output.Cast <L>().ToArray <L>());
                    powerShellResults2.MergeErrors <O>(@object);
                }
                else if (properties.ReturnObjectType == ReturnObjectTypes.PartialForList && this is IGetObjectForListService <L> )
                {
                    IGetObjectForListService <L> getObjectForListService = this as IGetObjectForListService <L>;
                    powerShellResults2 = getObjectForListService.GetObjectForList(identityForGetCmdlet);
                }
                if (powerShellResults2 != null)
                {
                    powerShellResults.MergeAll(powerShellResults2);
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 20
0
        public PowerShellResults <NewUMMailboxConfiguration> GetConfigurationForNewUMMailbox(Identity identity, UMEnableSelectedPolicyParameters properties)
        {
            properties.FaultIfNull();
            PSCommand pscommand = new PSCommand().AddCommand("Enable-UMMailbox");

            pscommand.AddParameter("Identity", identity);
            pscommand.AddParameter("ValidateOnly");
            if (properties.UMMailboxPolicy != null)
            {
                pscommand.AddParameter("UMMailboxPolicy", properties.UMMailboxPolicy);
            }
            PowerShellResults <NewUMMailboxConfiguration> powerShellResults = base.Invoke <NewUMMailboxConfiguration>(pscommand);

            if (!powerShellResults.Succeeded)
            {
                powerShellResults.ErrorRecords = Array.FindAll <ErrorRecord>(powerShellResults.ErrorRecords, (ErrorRecord x) => !(x.Exception is CouldNotGenerateExtensionException) && !(x.Exception is SipResourceIdAndExtensionsNeededException) && !(x.Exception is E164ResourceIdNeededException));
            }
            if (powerShellResults.SucceededWithValue)
            {
                PowerShellResults <UMMailboxPolicy> powerShellResults2 = powerShellResults.MergeErrors <UMMailboxPolicy>(base.GetObject <UMMailboxPolicy>("Get-UMMailboxPolicy", properties.UMMailboxPolicy));
                if (powerShellResults2.SucceededWithValue)
                {
                    powerShellResults.Value.Policy = powerShellResults2.Value;
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 21
0
        protected PowerShellResults <L> GetList <L, F>(PSCommand psCommand, F filter, SortOptions sort) where F : WebServiceParameters, new()
        {
            EcpPerfCounters.WebServiceGetList.Increment();
            Func <L[], L[]> func = (sort != null) ? sort.GetSortFunction <L>() : null;
            F f;

            if ((f = filter) == null)
            {
                f = Activator.CreateInstance <F>();
            }
            filter = f;
            PowerShellResults <L> powerShellResults = this.CoreInvoke <L>(psCommand, null, null, filter);

            if (func != null)
            {
                powerShellResults.Output = func(powerShellResults.Output);
            }
            ResultSizeFilter resultSizeFilter = filter as ResultSizeFilter;

            if (resultSizeFilter != null && powerShellResults.HasWarnings)
            {
                for (int i = 0; i < powerShellResults.Warnings.Length; i++)
                {
                    if (powerShellResults.Warnings[i] == Strings.WarningMoreResultsAvailable || powerShellResults.Warnings[i] == Strings.WarningDefaultResultSizeReached(resultSizeFilter.ResultSize.ToString()))
                    {
                        powerShellResults.Warnings[i] = ClientStrings.ListViewMoreResultsWarning;
                    }
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 22
0
        protected override void OnLoad(EventArgs e)
        {
            string value = this.Context.Request.QueryString["Identity"];

            if (string.IsNullOrEmpty(value))
            {
                throw new BadQueryParameterException("Identity");
            }
            if (string.IsNullOrEmpty(this.Context.Request.QueryString["Name"]))
            {
                throw new BadQueryParameterException("Name");
            }
            if (string.IsNullOrEmpty(this.Context.Request.QueryString["HandlerClass"]))
            {
                throw new BadQueryParameterException("HandlerClass");
            }
            Identity            identity            = Identity.FromIdParameter(value);
            WebServiceReference webServiceReference = new WebServiceReference(EcpUrl.EcpVDirForStaticResource + "DDI/DDIService.svc?schema=MigrationReport");
            PowerShellResults <JsonDictionary <object> > powerShellResults = (PowerShellResults <JsonDictionary <object> >)webServiceReference.GetObject(identity);

            if (!powerShellResults.SucceededWithValue)
            {
                throw new BadQueryParameterException("Identity");
            }
            if ((MigrationType)powerShellResults.Output[0]["MigrationType"] == MigrationType.BulkProvisioning)
            {
                this.OverrideStringsForBulkProvisioning();
            }
            if (this.linkShowReport != null)
            {
                this.linkShowReport.NavigateUrl = this.Context.Request.RawUrl.Replace("DownloadReport.aspx?", "Download.aspx?");
            }
            base.OnLoad(e);
        }
Ejemplo n.º 23
0
        public PowerShellResults <GetVoiceMailConfiguration> SetObject(Identity identity, SetVoiceMailConfiguration properties)
        {
            properties.FaultIfNull();
            identity = Identity.FromExecutingUserId();
            PowerShellResults <GetVoiceMailConfiguration> powerShellResults = new PowerShellResults <GetVoiceMailConfiguration>();
            PowerShellResults <GetVoiceMailConfiguration> @object           = this.GetObject(identity);

            powerShellResults.MergeErrors <GetVoiceMailConfiguration>(@object);
            if (powerShellResults.Failed)
            {
                return(powerShellResults);
            }
            powerShellResults.MergeErrors <UMMailboxPin>(base.SetObject <UMMailboxPin, SetVoiceMailPIN>("Set-UMMailboxPIN", identity, properties.SetVoiceMailPIN));
            if (powerShellResults.Failed)
            {
                return(powerShellResults);
            }
            properties.ReturnObjectType = ReturnObjectTypes.Full;
            powerShellResults.MergeAll(base.SetObject <GetVoiceMailConfiguration, SetVoiceMailConfiguration>("Set-UMMailbox", identity, properties));
            if (powerShellResults.SucceededWithValue)
            {
                GetVoiceMailConfiguration value = powerShellResults.Value;
                RbacPrincipal.Current.RbacConfiguration.ExecutingUserIsUmConfigured = value.IsConfigured;
                if (this.IsPhoneVerified(value.PhoneNumber, value) && !string.IsNullOrEmpty(properties.PhoneProviderId))
                {
                    PowerShellResults <SmsOptions> results = this.SetTextMessagingAccount(identity, value.PhoneNumber, value.PhoneProviderId, value);
                    powerShellResults.MergeErrors <SmsOptions>(results);
                }
            }
            return(powerShellResults);
        }
Ejemplo n.º 24
0
        private static PowerShellResults <T> GetProgressImpl <T>(string progressId, out AsyncServiceManager.WorkItem workItem)
        {
            PowerShellResults <T> powerShellResults = new PowerShellResults <T>();

            workItem = null;
            if (!string.IsNullOrEmpty(progressId) && AsyncServiceManager.workItems.TryGetValue(progressId, out workItem))
            {
                lock (workItem)
                {
                    if (workItem.Results != null)
                    {
                        PowerShellResults <T> powerShellResults2 = workItem.Results as PowerShellResults <T>;
                        if (powerShellResults2 != null)
                        {
                            powerShellResults = powerShellResults2;
                        }
                        else
                        {
                            powerShellResults.MergeErrors(workItem.Results);
                        }
                        AsyncServiceManager.workItems.Remove(progressId);
                        workItem.FinishedEvent.Close();
                    }
                    else
                    {
                        ProgressRecord progressRecord = null;
                        if (workItem.LegacyProgressRecord != null)
                        {
                            progressRecord = workItem.LegacyProgressRecord;
                        }
                        else
                        {
                            ProgressRecord progressRecord2 = (workItem.ProgressCalculator == null) ? new ProgressRecord() : workItem.ProgressCalculator.ProgressRecord;
                            lock (progressRecord2.SyncRoot)
                            {
                                progressRecord = new ProgressRecord
                                {
                                    Errors         = progressRecord2.Errors,
                                    FailedCount    = progressRecord2.FailedCount,
                                    MaxCount       = progressRecord2.MaxCount,
                                    Percent        = progressRecord2.Percent,
                                    Status         = progressRecord2.Status,
                                    SucceededCount = progressRecord2.SucceededCount,
                                    HasCompleted   = progressRecord2.HasCompleted,
                                    IsCancelled    = progressRecord2.IsCancelled
                                };
                                progressRecord2.Errors = null;
                            }
                        }
                        powerShellResults.ProgressRecord = progressRecord;
                    }
                }
            }
            DDIHelper.Trace("GetProgress: {0}, Results: {1}", new object[]
            {
                progressId,
                powerShellResults
            });
            return(powerShellResults);
        }
Ejemplo n.º 25
0
        public PowerShellResults <EndUserRoleRow> GetList(ManagementRoleFilter filter, SortOptions sort)
        {
            PowerShellResults <EndUserRoleRow> list = base.GetList <EndUserRoleRow, ManagementRoleFilter>("Get-ManagementRole", filter, sort);

            if (!list.Succeeded)
            {
                return(list);
            }
            list.Output = Array.FindAll <EndUserRoleRow>(list.Output, (EndUserRoleRow x) => x.IsEndUserRole);
            if (Util.IsDataCenter && filter != null && filter.Policy != null)
            {
                PowerShellResults <RoleAssignmentPolicy> result = EndUserRoles.policyService.GetObject(filter.Policy);
                if (result.HasValue)
                {
                    bool flag = (from role in list.Output
                                 where !string.IsNullOrEmpty(role.MailboxPlanIndex)
                                 select role).Count <EndUserRoleRow>() > 0;
                    if (flag)
                    {
                        list.Output = (from role in list.Output
                                       where string.IsNullOrEmpty(role.MailboxPlanIndex) || role.MailboxPlanIndex == result.Value.MailboxPlanIndex
                                       select role).ToArray <EndUserRoleRow>();
                    }
                }
                else
                {
                    list.Output = new EndUserRoleRow[0];
                }
            }
            return(list);
        }
Ejemplo n.º 26
0
        public PowerShellResults <AdminAuditLogResultRow> GetList(ExternalAccessFilter filter, SortOptions sort)
        {
            filter.ExternalAccess = new bool?(true);
            PowerShellResults <AdminAuditLogResultRow> list = base.GetList <AdminAuditLogResultRow, ExternalAccessFilter>("Search-AdminAuditLog", filter, sort);

            if (list.Succeeded)
            {
                PowerShellResults <AdminAuditLogResultRow> powerShellResults = new PowerShellResults <AdminAuditLogResultRow>();
                int num = list.Output.Length;
                AdminAuditLogResultRow[] array = new AdminAuditLogResultRow[num];
                for (int i = 0; i < num; i++)
                {
                    string text = string.Format("{0};{1};{2};{3}", new object[]
                    {
                        list.Output[i].AuditReportSearchBaseResult.ObjectModified,
                        list.Output[i].AuditReportSearchBaseResult.CmdletName,
                        filter.StartDate,
                        filter.EndDate
                    });
                    Identity id = new Identity(text, text);
                    array[i] = new AdminAuditLogResultRow(id, list.Output[i].AuditReportSearchBaseResult);
                }
                powerShellResults.Output = array;
                return(powerShellResults);
            }
            return(list);
        }
Ejemplo n.º 27
0
        public PowerShellResults <ImportContactsResult> ImportObject(Identity identity, ImportContactListParameters properties)
        {
            PowerShellResults <ImportContactsResult> powerShellResults = base.SetObject <ImportContactsResult, ImportContactListParameters>("Import-ContactList", identity, properties);
            bool succeeded = powerShellResults.Succeeded;

            return(powerShellResults);
        }
        protected override void RenderChanges()
        {
            PowerShellResults <AdminAuditLogDetailRow> powerShellResults = base.Results as PowerShellResults <AdminAuditLogDetailRow>;

            if (powerShellResults != null && powerShellResults.Output != null && powerShellResults.Succeeded && powerShellResults.Output.Length > 0)
            {
                Table table = new Table();
                int   num   = 0;
                while (num < powerShellResults.Output.Length && num < 500)
                {
                    AdminAuditLogDetailRow adminAuditLogDetailRow = powerShellResults.Output[num];
                    foreach (AdminAuditLogCmdletParameter adminAuditLogCmdletParameter in adminAuditLogDetailRow.AdminAuditLogEvent.CmdletParameters)
                    {
                        if (adminAuditLogCmdletParameter.Name.Equals("LitigationHoldEnabled", StringComparison.InvariantCultureIgnoreCase))
                        {
                            table.Rows.Add(base.GetDetailRowForTable(adminAuditLogDetailRow.AdminAuditLogEvent.RunDate.Value.ToUniversalTime().UtcToUserDateTimeString()));
                            table.Rows.Add(base.GetDetailRowForTable(adminAuditLogDetailRow.UserFriendlyCaller));
                            table.Rows.Add(base.GetDetailRowForTable(this.GetLocalizedState(adminAuditLogCmdletParameter.Value)));
                            table.Rows.Add(base.GetEmptyRowForTable());
                            break;
                        }
                    }
                    num++;
                }
                if (table.Rows.Count > 0)
                {
                    this.detailsPane.Controls.Add(table);
                    return;
                }
                table.Dispose();
            }
        }
Ejemplo n.º 29
0
        public PowerShellResults <RoleAssignmentPolicyRow> SetObject(Identity identity, SetRoleAssignmentPolicy properties)
        {
            properties.FaultIfNull();
            PowerShellResults <RoleAssignmentPolicyRow> powerShellResults;

            if (!string.IsNullOrEmpty(properties.Name) || !string.IsNullOrEmpty(properties.Description))
            {
                powerShellResults = base.SetObject <RoleAssignmentPolicyRow, SetRoleAssignmentPolicy>("Set-RoleAssignmentPolicy", identity, properties);
            }
            else
            {
                powerShellResults = base.GetObject <RoleAssignmentPolicyRow>("Get-RoleAssignmentPolicy", identity);
            }
            if (!powerShellResults.SucceededWithValue)
            {
                powerShellResults.Output = null;
                return(powerShellResults);
            }
            PowerShellResults <RoleAssignmentPolicy> @object = this.GetObject(identity);

            if (@object.SucceededWithValue && properties.AssignedEndUserRoles != null)
            {
                this.UpdateRoleAssignments(@object, properties);
            }
            if ([email protected])
            {
                powerShellResults.MergeErrors <RoleAssignmentPolicy>(@object);
                powerShellResults.Output = null;
            }
            return(powerShellResults);
        }
Ejemplo n.º 30
0
 private PowerShellResults <AdminRoleGroupRow> RemoveRoleAssignments(IEnumerable <Identity> removedRoles, ManagementRoleAssignments roleAssignmentsWebService, Identity identity, PowerShellResults <AdminRoleGroupRow> results)
 {
     if (removedRoles != null)
     {
         foreach (Identity roleIdentity in removedRoles)
         {
             PowerShellResults <ManagementRoleAssignment> roleAssignments = this.GetRoleAssignments(roleIdentity, identity, roleAssignmentsWebService);
             if (roleAssignments.Failed)
             {
                 results.MergeErrors <ManagementRoleAssignment>(roleAssignments);
                 return(results);
             }
             if (roleAssignments != null && roleAssignments.Output != null)
             {
                 ManagementRoleAssignment[] output = roleAssignments.Output;
                 IEnumerable <Identity>     source = from entry in output
                                                     where entry.DelegationType == RoleAssignmentDelegationType.Regular
                                                     select entry.Identity;
                 results.MergeErrors(roleAssignmentsWebService.RemoveObjects(source.ToArray <Identity>(), null));
                 if (results.Failed)
                 {
                     return(results);
                 }
             }
         }
         return(results);
     }
     return(results);
 }