private void BuildParameters(DataRow input, DataObjectStore store, ICollection <Parameter> parameters) { if (!base.SingletonObject) { Parameter item = new Parameter { Name = base.IdentityName, Reference = base.IdentityVariable, Type = ParameterType.Mandatory }; if (!parameters.Contains(item)) { parameters.Add(item); } } List <string> modifiedPropertiesBasedOnDataObject = store.GetModifiedPropertiesBasedOnDataObject(input, base.DataObjectName); foreach (string text in modifiedPropertiesBasedOnDataObject) { if (!string.Equals(base.IdentityName, text, StringComparison.OrdinalIgnoreCase)) { Parameter item2 = new Parameter { Name = text, Reference = text, Type = ParameterType.Mandatory }; if (!parameters.Contains(item2)) { parameters.Add(item2); } } } }
public static void BuildLanguageList(DataRow inputRow, DataTable dataTable, DataObjectStore store) { LanguageList lang = new LanguageList(); dataTable.BeginLoadData(); Array.ForEach <string>(HygieneUtils.antispamFilterableLanguages, delegate(string code) { string text = code.ToUpper().ToString(); DataRow dataRow = dataTable.NewRow(); try { dataRow["LanguageCode"] = text; dataRow["LanguageName"] = RtlUtil.ConvertToDecodedBidiString(lang.GetDisplayValue(code), RtlUtil.IsRtl); dataRow["Identity"] = new Identity(text, dataRow["LanguageName"].ToString()); } catch { dataRow["LanguageCode"] = text; dataRow["LanguageName"] = text; dataRow["Identity"] = new Identity(text, text); } dataTable.Rows.Add(dataRow); }); dataTable.EndLoadData(); }
public static void GetListPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { if (RbacPrincipal.Current.IsInRole("LiveID")) { DLPPolicy.AggregateData(inputRow, dataTable, store); } }
private static void AggregateData(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DLPPolicyReportingService dlppolicyReportingService = new DLPPolicyReportingService(); PowerShellResults <MailTrafficPolicyReport> dlptrafficData = dlppolicyReportingService.GetDLPTrafficData(new DLPPolicyTrafficReportParameters { StartDate = new DateTime?((DateTime)ExDateTime.GetNow(EcpDateTimeHelper.GetCurrentUserTimeZone()).Subtract(new TimeSpan(48, 0, 0)).ToUtc()), EndDate = new DateTime?((DateTime)ExDateTime.GetNow(EcpDateTimeHelper.GetCurrentUserTimeZone()).ToUtc()), EventType = "DlpPolicyHits,DlpPolicyOverride,DlpPolicyFalsePositive", Direction = "Outbound" }); if (dlptrafficData != null && dlptrafficData.Output != null) { IEnumerable <MailTrafficPolicyReport> source = from d in dlptrafficData.Output orderby d.Date.Date descending, d.Date.Hour descending select d; IEnumerable <MailTrafficPolicyReport> reportData = source.Take(24); IEnumerable <MailTrafficPolicyReport> trendData = source.Skip(24); foreach (object obj in dataTable.Rows) { DataRow row = (DataRow)obj; DLPPolicy.CalcuatePolicyData(row, "Name", "Hits", "HitsTrend", "DlpPolicyHits", reportData, trendData); DLPPolicy.CalcuatePolicyData(row, "Name", "Overrides", "OverridesTrend", "DlpPolicyOverride", reportData, trendData); DLPPolicy.CalcuatePolicyData(row, "Name", "FalsePositives", "FalsePositivesTrend", "DlpPolicyFalsePositive", reportData, trendData); } } }
public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate) { RunResult runResult = new RunResult(); foreach (string text in this.GetDataObjectKeys(store)) { object obj = null; IDataObjectCreator dataObjectCreator = store.GetDataObjectCreator(text); if (dataObjectCreator != null) { obj = dataObjectCreator.Create(dataTable); } else { Type dataObjectType = store.GetDataObjectType(text); if (null != dataObjectType) { obj = dataObjectType.GetConstructor(new Type[0]).Invoke(new object[0]); } } if (obj != null) { store.UpdateDataObject(text, obj, true); updateTableDelegate(text, false); } } runResult.DataObjectes.AddRange(store.GetKeys()); return(runResult); }
public static void GetListPostAction(DataRow inputrow, DataTable dataTable, DataObjectStore store) { List <DataRow> list = new List <DataRow>(); dataTable.BeginLoadData(); foreach (object obj in dataTable.Rows) { DataRow dataRow = (DataRow)obj; ElcFolderType elcFolderType = (ElcFolderType)dataRow["Type"]; if (elcFolderType == ElcFolderType.ManagedCustomFolder || elcFolderType == ElcFolderType.RecoverableItems) { list.Add(dataRow); } else { EnhancedTimeSpan?ageLimitForRetention = dataRow["AgeLimitForRetention"].IsNullValue() ? null : ((EnhancedTimeSpan?)dataRow["AgeLimitForRetention"]); dataRow["FolderType"] = RetentionUtils.GetLocalizedType((ElcFolderType)dataRow["Type"]); dataRow["RetentionDays"] = RetentionPolicyTagPropertiesHelper.GetRetentionDays(ageLimitForRetention, (bool)dataRow["RetentionEnabled"]); dataRow["RetentionPeriodDays"] = RetentionPolicyTagPropertiesHelper.GetRetentionPeriodDays(ageLimitForRetention, (bool)dataRow["RetentionEnabled"]); dataRow["RetentionPolicyActionType"] = RetentionUtils.GetLocalizedRetentionActionType((RetentionActionType)dataRow["RetentionAction"]); } } foreach (DataRow row in list) { dataTable.Rows.Remove(row); } dataTable.EndLoadData(); }
public static void GetSDOPostAction(DataRow input, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; dataRow["DisplayedManagedBy"] = DistributionGroupHelper.ResolveRecipientDisplayNamesForSDO(dataRow["ManagedBy"]); dataRow["DisplayedModeratedBy"] = DistributionGroupHelper.ResolveRecipientDisplayNamesForSDO(dataRow["ModeratedBy"]); }
public static void PreGetObjectAction(DataRow inputrow, DataTable dataTable, DataObjectStore store) { string text = string.Empty; if (inputrow["Identity"] is Identity) { Identity identity = (Identity)inputrow["Identity"]; text = identity.RawIdentity; } else { text = (string)inputrow["Identity"]; } string[] array = text.Split(new char[] { ' ' }); inputrow["MessageTraceId"] = array[0]; inputrow["RecipientAddress"] = array[1]; store.SetModifiedColumns(new List <string>(new string[] { "MessageTraceId", "RecipientAddress" })); }
public static void GetDomainOptions(DataRow inputRow, DataTable dataTable, DataObjectStore store) { List <string> cloudDomainNames = null; string text = inputRow["CloudDomains"] as string; if (text != null) { cloudDomainNames = (from cloudDomain in text.Split(new char[] { ',' }) select cloudDomain.Trim()).ToList <string>(); } IEnumerable <object> source = store.GetDataObject("AcceptedDomain") as IEnumerable <object>; IEnumerable <object> enumerable = from domain in source where HybridConfigurationWizardServiceCodeBehind.IsSelectableDomain((Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)domain, cloudDomainNames) select((Microsoft.Exchange.Data.Directory.SystemConfiguration.AcceptedDomain)domain).DomainName.SmtpDomain; int num = enumerable.Count <object>(); if (num != 0) { inputRow["DomainOptions"] = (dataTable.Rows[0]["DomainOptions"] = enumerable); } if (num == 1) { store.SetModifiedColumns(new List <string> { "Domains" }); inputRow["Domains"] = (dataTable.Rows[0]["Domains"] = enumerable.First <object>().ToString()); } }
public static void GetFFOForNew(DataRow input, DataTable dataTable, DataObjectStore store) { if (dataTable.Rows.Count == 0) { return; } DataRow dataRow = dataTable.Rows[0]; ADObjectId executingUserId = EacRbacPrincipal.Instance.ExecutingUserId; dataRow["ManagedBy"] = new JsonDictionary <object>[] { new JsonDictionary <object>(new Dictionary <string, object> { { "__type", "JsonDictionaryOfanyType:#Microsoft.Exchange.Management.ControlPanel" }, { "Identity", new Identity(executingUserId.Name, executingUserId.Name) }, { "DisplayName", executingUserId.Name }, { "Name", executingUserId.Name } }) }; }
public static void SetGallatinFlag(DataRow inputRow, DataTable dataTable, DataObjectStore store) { string a = dataTable.Rows[0]["ServiceInstance"] as string; string a2 = inputRow["ServiceInstance"] as string; inputRow["IsGallatin"] = (dataTable.Rows[0]["IsGallatin"] = (string.Equals(a, "1") || string.Equals(a2, "1"))); }
public static void SetIfFederatedDisable(DataRow row, DataTable dataTable, DataObjectStore store) { if (!Datacenter.IsMultiTenancyEnabled() && store.GetDataObject("FederationTrust") == null) { dataTable.Rows[0]["FederationDisabled"] = true; } }
public static object CalculateLambdaExpression(ColumnExpression expression, Type dataType, DataRow dataRow, DataRow inputRow) { object result; try { Type[] servicePredefinedTypes = null; if (inputRow != null) { DataObjectStore dataObjectStore = inputRow.Table.ExtendedProperties["DataSourceStore"] as DataObjectStore; if (dataObjectStore != null) { servicePredefinedTypes = dataObjectStore.ServicePredefinedTypes; } } result = ExpressionCalculator.CalculateLambdaExpression(expression, dataType, servicePredefinedTypes, dataRow, inputRow); } catch (ParseException innerException) { throw new LambdaExpressionException(expression.Expression, innerException); } catch (TargetInvocationException innerException2) { throw new LambdaExpressionException(expression.Expression, innerException2); } return(result); }
public static void GenerateName(DataRow inputRow, DataTable dataTable, DataObjectStore store) { ReducedRecipient reducedRecipient = store.GetDataObject("ReducedRecipient") as ReducedRecipient; string text = (string)inputRow["DisplayName"]; if (reducedRecipient != null) { string text2 = " " + Guid.NewGuid().ToString("B").ToUpperInvariant(); if (text.Length > 64) { text = text.SurrogateSubstring(0, text.Length - text2.Length); } inputRow["Name"] = text + text2; } else { if (text.Length > 64) { text = text.SurrogateSubstring(0, 64); } inputRow["Name"] = text; } store.SetModifiedColumns(new List <string> { "Name" }); }
public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate) { RunResult runResult = new RunResult(); IPSCommandWrapper ipscommandWrapper = base.PowershellFactory.CreatePSCommand(); Activity activity = null; foreach (Activity activity2 in base.Body) { ((CmdletActivity)activity2).BuildCommand(input, dataTable, store, codeBehind); ipscommandWrapper.AddCommand(((CmdletActivity)activity2).Command.Commands[0]); activity = activity2; } if (activity != null) { base.CurrentExecutingActivity = activity; ((CmdletActivity)activity).Command = ipscommandWrapper; RunResult runResult2 = activity.Run(input, dataTable, store, codeBehind, updateTableDelegate); runResult.DataObjectes.AddRange(runResult2.DataObjectes); this.statusReport = this.statusReport.Concat(activity.GetStatusReport(input, dataTable, store)).ToArray <PowerShellResults>(); base.CurrentExecutingActivity = null; if (runResult2.ErrorOccur && base.ErrorBehavior == ErrorBehavior.Stop && activity.ErrorBehavior == ErrorBehavior.Stop) { runResult.ErrorOccur = true; return(runResult); } } return(runResult); }
public sealed override bool IsRunnable(DataRow input, DataTable dataTable, DataObjectStore store) { if (AsyncServiceManager.IsCurrentWorkCancelled()) { return(false); } List <Parameter> parametersToInvoke = this.GetParametersToInvoke(input, dataTable, store); bool flag = this.IsToExecuteCmdlet(input, dataTable, store, parametersToInvoke); if (!flag) { return(false); } List <string> parameters = (from x in parametersToInvoke select x.Name).ToList <string>(); string cmdletRbacString = this.GetCmdletRbacString(store, parameters); bool flag2 = base.RbacChecker.IsInRole(cmdletRbacString); DDIHelper.Trace("Checking RBAC: {0} : {1}", new object[] { cmdletRbacString, flag2 }); if (!flag2) { throw new CmdletAccessDeniedException(Strings.AccessDeniedMessage); } return(true); }
internal void BuildCommand(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind) { this.Command = base.PowershellFactory.CreatePSCommand().AddCommand(this.GetCommandText(store)); foreach (Parameter parameter in this.GetEffectiveParameters(input, dataTable, store)) { if (parameter.IsRunnable(input, dataTable)) { switch (parameter.Type) { case ParameterType.Switch: this.Command.AddParameter(parameter.Name); break; case ParameterType.Mandatory: case ParameterType.RunOnModified: { object value = Parameter.ConvertToParameterValue(input, dataTable, parameter, store); this.Command.AddParameter(parameter.Name, value); break; } default: throw new NotSupportedException(); } } } }
public static void GetFFOMailUserSDO(DataRow inputRow, DataTable table, DataObjectStore store) { GetRecipientCmdlet getRecipientCmdlet = new GetRecipientCmdlet { Identity = ((Identity)inputRow["Identity"]).RawIdentity }; getRecipientCmdlet.Authenticator = PswsAuthenticator.Create(); getRecipientCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null); Recipient[] array = getRecipientCmdlet.Run(); if (array == null || array.Length == 0) { throw new ExArgumentOutOfRangeException(); } Recipient recipient = array.First <Recipient>(); DataRow dataRow = table.Rows[0]; dataRow["Identity"] = new Identity(recipient.Guid.ToString()); dataRow["DisplayName"] = recipient.DisplayName; dataRow["Alias"] = recipient.Alias; dataRow["PrimarySmtpAddress"] = recipient.PrimarySmtpAddress; dataRow["Name"] = recipient.Name; dataRow["FirstName"] = recipient.FirstName; dataRow["LastName"] = recipient.LastName; dataRow["Title"] = recipient.Title; dataRow["Department"] = recipient.Department; dataRow["Office"] = recipient.Office; dataRow["Phone"] = recipient.Phone; }
public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate) { RunResult runResult = new RunResult(); PowerShellResults <PSObject> powerShellResults; base.ExecuteCmdlet(null, runResult, out powerShellResults, false); if (!runResult.ErrorOccur && powerShellResults.Succeeded && !string.IsNullOrEmpty(base.DataObjectName)) { runResult.DataObjectes.Add(base.DataObjectName); store.UpdateDataObject(base.DataObjectName, null); if (store.GetDataObjectType(base.DataObjectName) == typeof(object)) { if (powerShellResults.Output != null) { store.UpdateDataObject(base.DataObjectName, (from c in powerShellResults.Output select c.BaseObject).ToList <object>()); } } else if (powerShellResults.HasValue && powerShellResults.Value != null) { store.UpdateDataObject(base.DataObjectName, powerShellResults.Value.BaseObject); } updateTableDelegate(base.DataObjectName, this.FillAllColumns); } return(runResult); }
public static void GetObjectPostAction(DataRow inputRow, DataTable table, DataObjectStore store) { DataRow dataRow = table.Rows[0]; if (dataRow["SimpleEmailAddresses"] != DBNull.Value) { dataRow["EmailAddresses"] = EmailAddressList.FromProxyAddressCollection((ProxyAddressCollection)dataRow["SimpleEmailAddresses"]); } if (dataRow["ObjectCountryOrRegion"] != DBNull.Value) { dataRow["CountryOrRegion"] = ((CountryInfo)dataRow["ObjectCountryOrRegion"]).Name; } MailboxPropertiesHelper.GetMaxSendReceiveSize(inputRow, table, store); MailboxPropertiesHelper.GetAcceptRejectSendersOrMembers(inputRow, table, store); if (dataRow["EmailAddresses"] != DBNull.Value && dataRow["RemoteRoutingAddress"] != DBNull.Value) { EmailAddressList emailAddressList = (EmailAddressList)dataRow["EmailAddresses"]; string strA = (string)dataRow["RemoteRoutingAddress"]; foreach (EmailAddressItem emailAddressItem in emailAddressList) { string identity = emailAddressItem.Identity; if (string.Compare(strA, identity, true) == 0) { dataRow["RemoteRoutingAddress"] = identity; break; } } } dataRow["IsRemoteUserMailbox"] = ((RecipientTypeDetails)((ulong)int.MinValue)).Equals(dataRow["RecipientTypeDetails"]); }
public static void SetObjectPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; List <string> list = new List <string>(); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "IssueWarningQuota", list); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendQuota", list); MailboxPropertiesHelper.SaveQuotaProperty(dataRow, null, "ProhibitSendReceiveQuota", list); if (DBNull.Value != dataRow["DeletedItemRetention"]) { dataRow["DeletedItemRetention"] = EnhancedTimeSpan.Parse((string)dataRow["DeletedItemRetention"]); list.Add("DeletedItemRetention"); } if (DBNull.Value != dataRow["MailboxRetention"]) { dataRow["MailboxRetention"] = EnhancedTimeSpan.Parse((string)dataRow["MailboxRetention"]); list.Add("MailboxRetention"); } DatabasePropertiesHelper.SetScheduleProperty(dataRow, "MaintenanceSchedule", list); DatabasePropertiesHelper.SetScheduleProperty(dataRow, "QuotaNotificationSchedule", list); if (list.Count != 0) { store.SetModifiedColumns(list); } }
public static void NewFFOMailUser(DataRow inputRow, DataTable table, DataObjectStore store) { NewMailUserCmdlet newMailUserCmdlet = new NewMailUserCmdlet(); newMailUserCmdlet.Authenticator = PswsAuthenticator.Create(); newMailUserCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null); if (!string.IsNullOrEmpty(inputRow["FirstName"].ToString())) { newMailUserCmdlet.FirstName = inputRow["FirstName"].ToString(); } if (!string.IsNullOrEmpty(inputRow["Initials"].ToString())) { newMailUserCmdlet.Initials = inputRow["Initials"].ToString(); } if (!string.IsNullOrEmpty(inputRow["LastName"].ToString())) { newMailUserCmdlet.LastName = inputRow["LastName"].ToString(); } if (!string.IsNullOrEmpty(inputRow["ExternalEmailAddress"].ToString())) { newMailUserCmdlet.ExternalEmailAddress = inputRow["ExternalEmailAddress"].ToString(); } newMailUserCmdlet.Alias = inputRow["Alias"].ToString(); newMailUserCmdlet.DisplayName = inputRow["MailUserDisplayName"].ToString(); newMailUserCmdlet.Name = inputRow["MailUserDisplayName"].ToString(); newMailUserCmdlet.Password = inputRow["PlainPassword"].ToString(); newMailUserCmdlet.PrimarySmtpAddress = inputRow["PrimarySmtpAddress"].ToString(); newMailUserCmdlet.MicrosoftOnlineServicesID = inputRow["MicrosoftOnlineServicesID"].ToString(); newMailUserCmdlet.Run(); if (!string.IsNullOrEmpty(newMailUserCmdlet.Error)) { throw new Exception(newMailUserCmdlet.Error); } }
public static void GetFFOMailUserList(DataRow inputRow, DataTable table, DataObjectStore store) { try { table.BeginLoadData(); GetRecipientCmdlet getRecipientCmdlet = new GetRecipientCmdlet { Filter = inputRow["SearchText"].ToString().ToRecipeintFilterString("((RecipientTypeDetails -eq 'UserMailbox') -or (RecipientTypeDetails -eq 'MailUser'))"), Properties = "Identity,DisplayName,PrimarySmtpAddress,RecipientTypeDetails" }; getRecipientCmdlet.Authenticator = PswsAuthenticator.Create(); getRecipientCmdlet.HostServerName = AppConfigLoader.GetConfigStringValue("PswsHostName", null); foreach (Recipient recipient in getRecipientCmdlet.Run()) { DataRow dataRow = table.NewRow(); dataRow["Identity"] = new Identity(recipient.Guid.ToString()); dataRow["DisplayName"] = recipient.DisplayName; dataRow["PrimarySmtpAddress"] = recipient.PrimarySmtpAddress; dataRow["RecipientTypeDetails"] = FFOMailUser.GenerateUserTypeText(Enum.Parse(typeof(RecipientTypeDetails), recipient.RecipientTypeDetails, true)); table.Rows.Add(dataRow); } } finally { table.EndLoadData(); } }
protected string GetCommandText(DataObjectStore store) { if (string.IsNullOrEmpty(this.CommandText)) { return(this.GetVerb() + store.GetDataObjectType(this.DataObjectName).Name); } return(this.CommandText); }
protected string GetRbacCommandText(DataObjectStore store) { if (!string.IsNullOrEmpty(this.SnapInAlias)) { return(this.SnapInAlias + "\\" + this.GetCommandText(store)); } return(this.GetCommandText(store)); }
public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate) { RunResult runResult = new RunResult(); PowerShellResults <PSObject> powerShellResults; this.ExecuteCmdlet(null, runResult, out powerShellResults, false); return(runResult); }
public static void DialPostAction(DataRow inputRow, DataTable dataTable, DataObjectStore store, PowerShellResults[] results) { if (results[0].Succeeded) { DataRow dataRow = dataTable.Rows[0]; results[0].ProgressId = dataRow["Identity"].ToString(); } }
internal override bool HasPermission(DataRow input, DataTable dataTable, DataObjectStore store, Variable updatingVariable) { if (base.CheckCondition(input, dataTable)) { return(base.Then == null || base.Then.HasPermission(input, dataTable, store, updatingVariable)); } return(base.Else == null || base.Else.HasPermission(input, dataTable, store, updatingVariable)); }
public static void GetListPostAction(DataRow inputrow, DataTable dataTable, DataObjectStore store) { foreach (object obj in dataTable.Rows) { DataRow dataRow = (DataRow)obj; dataRow["Identity"] = new Identity(dataRow["Identity"].ToString().Replace(" ", "+")); } }
public static void GetDAGListPostAction(DataRow row, DataTable dataTable, DataObjectStore store) { foreach (object obj in dataTable.Rows) { DataRow dataRow = (DataRow)obj; dataRow["WitnessServer"] = dataRow["WitnessServerValue"]; dataRow["WitnessDirectory"] = dataRow["WitnessDirectoryValue"]; } }