internal static string[] ConvertPresentationFormatToWireUserList(IRecipientSession adRecipientSession, MultiValuedProperty <ADObjectId> userList) { if (userList != null && userList.Count > 0) { Result <ADRawEntry>[] array = adRecipientSession.ReadMultiple(userList.ToArray(), new PropertyDefinition[] { ADObjectSchema.Guid, ADRecipientSchema.ExternalDirectoryObjectId }); if (array != null && array.Length > 0) { string[] array2 = new string[array.Length]; for (int i = 0; i < array.Length; i++) { array2[i] = InstalledExtensionTable.GetWireUserId(array[i].Data, array[i].Data.Id); } return(array2); } } return(null); }
internal static void EmailAddressesSetter(object value, IPropertyBag propertyBag) { ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)value; if (proxyAddressCollection == null || proxyAddressCollection.WasCleared) { throw new MservOperationException(DirectoryStrings.NoResetOrAssignedMvp); } string puidKey = MServRecipientSchema.GetPuidKey(propertyBag); MultiValuedProperty <MservRecord> multiValuedProperty = (MultiValuedProperty <MservRecord>)propertyBag[MServRecipientSchema.MservEmailAddressesRecord]; foreach (ProxyAddress proxyAddress in proxyAddressCollection.Added) { bool flag = true; MservRecord mservRecord = new MservRecord(proxyAddress.AddressString, 0, null, puidKey, 0); foreach (MservRecord record in multiValuedProperty.Added) { if (mservRecord.SameRecord(record)) { flag = false; break; } } if (flag) { multiValuedProperty.Add(mservRecord); } } foreach (ProxyAddress proxyAddress2 in proxyAddressCollection.Removed) { foreach (MservRecord mservRecord2 in multiValuedProperty.ToArray()) { if (proxyAddress2.AddressString.Equals(mservRecord2.Key, StringComparison.OrdinalIgnoreCase)) { multiValuedProperty.Remove(mservRecord2); break; } } } }
internal static MultiValuedProperty <string> AddDNStringSyntax(MultiValuedProperty <string> objectDNString, ProviderPropertyDefinition propertyDefinition, IPropertyBag propertyBag) { if (objectDNString == null) { return(objectDNString); } string[] array = objectDNString.ToArray(); ADObjectId adobjectId = (ADObjectId)propertyBag[ADObjectSchema.Id]; string distinguishedName = adobjectId.DistinguishedName; for (int i = 0; i < array.Length; i++) { array[i] = string.Concat(new string[] { "S:", array[i].Length.ToString(), ":", array[i], ":", distinguishedName }); } return(new MultiValuedProperty <string>(false, propertyDefinition, array)); }
private MultiValuedProperty <string> ResolveAndMerge(MultiValuedProperty <ADObjectId> recipientList, MultiValuedProperty <string> existingAddress) { if (recipientList == null || recipientList.Count == 0) { return(existingAddress); } MultiValuedProperty <string> multiValuedProperty = null; IRecipientSession tenantGlobalCatalogSession = base.TenantGlobalCatalogSession; Result <ADRecipient>[] array = tenantGlobalCatalogSession.ReadMultiple(recipientList.ToArray()); multiValuedProperty = new MultiValuedProperty <string>(); foreach (Result <ADRecipient> result in array) { if (result.Error == null && result.Data != null && !this.DoesExist(result.Data, existingAddress)) { multiValuedProperty.Add(result.Data.LegacyExchangeDN); } } foreach (string item in existingAddress) { multiValuedProperty.Add(item); } return(multiValuedProperty); }
private void RemoveNodeFromCluster() { this.m_output.WriteProgressSimple(Strings.DagTaskRemovedNodeToCluster(this.m_mailboxServerName)); using (IAmClusterNode amClusterNode = this.m_clusDag.OpenNode(this.m_mailboxAmServerName)) { bool flag = false; string empty = string.Empty; string remoteServerName = "<unknown>"; try { using (IAmClusterGroup amClusterGroup = this.m_clusDag.FindCoreClusterGroup()) { AmServerName ownerNode = amClusterGroup.OwnerNode; remoteServerName = ownerNode.Fqdn; ReplayRpcClientWrapper.RunEvictNodeFromCluster(ownerNode, this.m_mailboxAmServerName, out empty); } } catch (DagTaskOperationFailedException ex) { AmClusterEvictWithoutCleanupException ex2; if (ex.TryGetTypedInnerException(out ex2)) { this.m_output.WriteWarning(ex2.LocalizedString); } else { DagTaskHelper.LogRemoteVerboseLog(this.m_output, remoteServerName, empty); this.m_output.WriteErrorSimple(ex); } } catch (LocalizedException error) { DagTaskHelper.LogRemoteVerboseLog(this.m_output, remoteServerName, empty); this.m_output.WriteErrorSimple(error); } DagTaskHelper.LogRemoteVerboseLog(this.m_output, remoteServerName, empty); if (flag) { this.m_output.WriteWarning(Strings.DagTaskRemoveNodeCleanupFailed(amClusterNode.Name.Fqdn)); } } this.m_output.WriteProgressSimple(Strings.DagTaskRemovedNodeToCluster(this.m_mailboxServerName)); if (this.m_clusDag.CnoName != string.Empty) { this.m_output.WriteProgressSimple(Strings.DagTaskFixingUpIpResources); List <AmServerName> source = this.m_clusDag.EnumerateNodeNames().ToList <AmServerName>(); IEnumerable <AmServerName> enumerable = from name in source where name != this.m_mailboxAmServerName select name; IEnumerable <string> source2 = from serverName in enumerable select serverName.NetbiosName; this.m_output.AppendLogMessage("Refreshing the cluster using the names [{0}].", new object[] { string.Join(", ", source2.ToArray <string>()) }); this.m_clusDag.Dispose(); MultiValuedProperty <IPAddress> databaseAvailabilityGroupIpv4Addresses = this.m_dag.DatabaseAvailabilityGroupIpv4Addresses; IPAddress[] array = new IPAddress[0]; if (databaseAvailabilityGroupIpv4Addresses.Count > 0) { array = databaseAvailabilityGroupIpv4Addresses.ToArray(); } string[] value = (from addr in array select addr.ToString()).ToArray <string>(); this.m_output.AppendLogMessage("Got the following IP addresses for the DAG (blank means DHCP): {0}", new object[] { string.Join(",", value) }); this.m_clusDag = AmCluster.OpenByNames(enumerable); using (IAmClusterGroup amClusterGroup2 = this.m_clusDag.FindCoreClusterGroup()) { using (IAmClusterResource amClusterResource = amClusterGroup2.FindResourceByTypeName("Network Name")) { this.m_output.AppendLogMessage("Cluster group net name = '{0}'.", new object[] { amClusterResource.Name }); LocalizedString value2 = AmClusterResourceHelper.FixUpIpAddressesForNetName(this.m_output, this.m_clusDag, (AmClusterGroup)amClusterGroup2, (AmClusterResource)amClusterResource, array); this.m_output.WriteProgressSimple(Strings.DagTaskFixedUpIpResources(value2)); } } } }
// Token: 0x06001375 RID: 4981 RVA: 0x000718EC File Offset: 0x0006FAEC private static PropTag[] GetPropTagArray(object collectionObject) { MultiValuedProperty <int> multiValuedProperty = (MultiValuedProperty <int>)collectionObject; return(Array.ConvertAll <int, PropTag>(multiValuedProperty.ToArray(), (int propTag) => (PropTag)propTag)); }
protected override bool UpdateTargetMissingProperty(string sourceId, ADPropertyDefinition propertyDefinition, PropertyReference propertyReference, ADRawEntry target) { string text = (string)target[SyncObjectSchema.ObjectId]; MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)target[ADObjectSchema.ObjectClass]; DirectoryObjectClassAddressList?directoryObjectClassAddressList = null; foreach (string key in multiValuedProperty) { if (this.directoryClassLookup.ContainsKey(key)) { directoryObjectClassAddressList = new DirectoryObjectClassAddressList?(this.directoryClassLookup[key]); break; } } if (directoryObjectClassAddressList == null) { ExTraceGlobals.BackSyncTracer.TraceError <string, string, string>((long)SyncConfiguration.TraceId, "PropertyReferenceTargetMissingPropertyResolver:: - Skipping property reference {0} -> {1}. Unsupported target class: {2}", sourceId, text, string.Join(",", multiValuedProperty.ToArray())); return(false); } propertyReference.UpdateReferenceData(text, directoryObjectClassAddressList.Value); return(true); }
internal static void ValidateCustomMenu(LocalizedString setting, IConfigurationSession session, string property, MultiValuedProperty <CustomMenuKeyMapping> customMenu, int numberOfDigitsInExtension, UMAutoAttendant containingAutoAttendant, DataAccessHelper.GetDataObjectDelegate getUniqueObject, out bool serializeAgain) { serializeAgain = false; new List <string>(); IRecipientSession recipientSessionScopedToOrganization = Utility.GetRecipientSessionScopedToOrganization(containingAutoAttendant.OrganizationId, true); foreach (CustomMenuKeyMapping customMenuKeyMapping in customMenu) { if (!string.IsNullOrEmpty(customMenuKeyMapping.AutoAttendantName)) { ValidationHelper.ValidateLinkedAutoAttendant(session, customMenuKeyMapping.AutoAttendantName, containingAutoAttendant.Status == StatusEnum.Enabled, containingAutoAttendant); } string text = Utils.TrimSpaces(customMenuKeyMapping.PromptFileName); if (text != null) { ValidationHelper.ValidateWavFile(text); } if (!string.IsNullOrEmpty(customMenuKeyMapping.LeaveVoicemailFor)) { string legacyDNToUseForLeaveVoicemailFor; ValidationHelper.ValidateMailbox(setting, customMenuKeyMapping.LeaveVoicemailFor, containingAutoAttendant.UMDialPlan, recipientSessionScopedToOrganization, getUniqueObject, out legacyDNToUseForLeaveVoicemailFor); customMenuKeyMapping.LegacyDNToUseForLeaveVoicemailFor = legacyDNToUseForLeaveVoicemailFor; serializeAgain = true; } if (!string.IsNullOrEmpty(customMenuKeyMapping.TransferToMailbox)) { string legacyDNToUseForTransferToMailbox; ValidationHelper.ValidateMailbox(setting, customMenuKeyMapping.TransferToMailbox, containingAutoAttendant.UMDialPlan, recipientSessionScopedToOrganization, getUniqueObject, out legacyDNToUseForTransferToMailbox); customMenuKeyMapping.LegacyDNToUseForTransferToMailbox = legacyDNToUseForTransferToMailbox; serializeAgain = true; } } CustomMenuKeyMapping[] array = customMenu.ToArray(); Dictionary <string, int> dictionary = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase); Dictionary <CustomMenuKey, bool> dictionary2 = new Dictionary <CustomMenuKey, bool>(); for (int i = 0; i < array.Length; i++) { CustomMenuKeyMapping customMenuKeyMapping2 = array[i]; try { dictionary.Add(customMenuKeyMapping2.Description, i); } catch (ArgumentException) { throw new InvalidCustomMenuException(Strings.DuplicateMenuName(customMenuKeyMapping2.Description)); } if (!string.IsNullOrEmpty(customMenuKeyMapping2.AsrPhrases) && customMenuKeyMapping2.AsrPhrases.Length > 256) { throw new InvalidCustomMenuException(Strings.MaxAsrPhraseLengthExceeded(customMenuKeyMapping2.Description)); } string[] asrPhraseList = customMenuKeyMapping2.AsrPhraseList; if (asrPhraseList != null) { if (asrPhraseList.Length > 9) { throw new InvalidCustomMenuException(Strings.MaxAsrPhraseCountExceeded(customMenuKeyMapping2.Description)); } for (int j = 0; j < asrPhraseList.Length; j++) { if (string.IsNullOrEmpty(asrPhraseList[j])) { throw new InvalidCustomMenuException(Strings.EmptyASRPhrase(customMenuKeyMapping2.Description)); } try { dictionary.Add(asrPhraseList[j], -1); } catch (ArgumentException) { if (dictionary[asrPhraseList[j]] != i) { throw new InvalidCustomMenuException(Strings.DuplicateASRPhrase(asrPhraseList[j])); } } } } try { if (customMenuKeyMapping2.MappedKey != CustomMenuKey.NotSpecified) { dictionary2.Add(customMenuKeyMapping2.MappedKey, true); } } catch (ArgumentException) { throw new InvalidCustomMenuException(Strings.DuplicateKeys(customMenuKeyMapping2.Key)); } } }
protected override void InternalApplyChangeAndValidate() { TaskLogger.LogEnter(); if (!this.DataObject.IsUnscopedTopLevel && this.UnScopedTopLevel) { base.WriteError(new InvalidOperationException(Strings.ParameterAllowedOnlyForTopLevelRoleManipulation("UnScopedTopLevel", RoleType.UnScoped.ToString())), ErrorCategory.InvalidOperation, null); } string[] parameters = null; this.originalEntry = RoleHelper.GetMandatoryRoleEntry(this.DataObject, this.Identity.CmdletOrScriptName, this.Identity.PSSnapinName, new Task.TaskErrorLoggingDelegate(base.WriteError)); string[] parameters2; if (!this.AddParameter.IsPresent && !this.RemoveParameter.IsPresent) { parameters2 = this.Parameters; parameters = this.Parameters; } else { MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>(); foreach (string item in this.originalEntry.Parameters) { multiValuedProperty.Add(item); } if (this.Parameters != null) { List <string> list = null; if (this.AddParameter.IsPresent) { parameters = this.Parameters; foreach (string item2 in this.Parameters) { if (multiValuedProperty.Contains(item2)) { if (list == null) { list = new List <string>(); } list.Add(item2); } else { multiValuedProperty.Add(item2); } } } else { foreach (string item3 in this.Parameters) { if (!multiValuedProperty.Contains(item3)) { if (list == null) { list = new List <string>(); } list.Add(item3); } else { multiValuedProperty.Remove(item3); } } } if (list != null && 0 < list.Count) { LocalizedString value = this.AddParameter.IsPresent ? Strings.ErrorAddExistentParameters(this.Identity.RoleId.ToString(), this.Identity.CmdletOrScriptName, string.Join(",", list.ToArray())) : Strings.ErrorRemoveNonExistentParameters(this.Identity.RoleId.ToString(), this.Identity.CmdletOrScriptName, string.Join(",", list.ToArray())); base.WriteError(new InvalidOperationException(value), ErrorCategory.InvalidOperation, this.DataObject.Id); } } parameters2 = multiValuedProperty.ToArray(); } try { if (this.originalEntry is CmdletRoleEntry) { string pssnapinName = ((CmdletRoleEntry)this.originalEntry).PSSnapinName; if (base.IsEntryValidationRequired()) { base.VerifyCmdletEntry(this.originalEntry.Name, pssnapinName, parameters); } this.modifiedEntry = new CmdletRoleEntry(this.originalEntry.Name, pssnapinName, parameters2); } else if (this.originalEntry is ScriptRoleEntry) { if (base.IsEntryValidationRequired()) { base.VerifyScriptEntry(this.originalEntry.Name, parameters, this.SkipScriptExistenceCheck); } this.modifiedEntry = new ScriptRoleEntry(this.originalEntry.Name, parameters2); } else if (this.originalEntry is ApplicationPermissionRoleEntry) { this.modifiedEntry = new ApplicationPermissionRoleEntry(this.originalEntry.Name, parameters2); } else { if (!(this.originalEntry is WebServiceRoleEntry)) { throw new NotSupportedException("this.originalEntry is not a valid type."); } base.WriteError(new InvalidOperationException(Strings.CannotSetWebServiceRoleEntry(this.originalEntry.Name)), ErrorCategory.InvalidOperation, null); } } catch (FormatException ex) { base.WriteError(new ArgumentException(new LocalizedString(ex.Message)), ErrorCategory.InvalidArgument, this.DataObject.Id); } if (!this.modifiedEntry.Equals(this.originalEntry)) { if (null != this.originalEntry) { this.DataObject.RoleEntries.Remove(this.originalEntry); } this.DataObject.RoleEntries.Add(this.modifiedEntry); this.DataObject.ApplyChangesToDownlevelData(base.ParentRole ?? this.DataObject); } TaskLogger.LogExit(); }
private string GenerateScriptVarCommand(object varName, object varValue) { string result = string.Empty; if (varValue == null) { result = string.Format("$Role{0} = $null", varName); } else if (varValue is bool || varValue is SwitchParameter) { result = string.Format("$Role{0} = ${1}", varName, varValue); } else if (varValue is string[]) { result = string.Format("$Role{0} = {1}", varName, Globals.PowerShellArrayFromStringArray((string[])varValue)); } else if (varValue is MultiValuedProperty <string> ) { result = string.Format("$Role{0} = {1}", varName, Globals.PowerShellArrayFromStringArray(((MultiValuedProperty <string>)varValue).ToArray())); } else if (varValue is MultiValuedProperty <Capability> ) { MultiValuedProperty <Capability> multiValuedProperty = varValue as MultiValuedProperty <Capability>; MultiValuedProperty <string> multiValuedProperty2 = new MultiValuedProperty <string>(); foreach (Capability capability in multiValuedProperty) { multiValuedProperty2.Add(capability.ToString()); } result = string.Format("$Role{0} = {1}", varName, Globals.PowerShellArrayFromStringArray(multiValuedProperty2.ToArray())); } else if (varValue is Version) { Version version = (Version)varValue; result = string.Format("$Role{0} = '{1}.{2:D2}.{3:D4}.{4:D3}'", new object[] { varName, version.Major, version.Minor, version.Build, version.Revision }); } else { result = string.Format("$Role{0} = '{1}'", varName, varValue.ToString().Replace("'", "''")); } return(result); }
// Token: 0x0600081D RID: 2077 RVA: 0x0002162C File Offset: 0x0001F82C private MiniServer GetActiveServer(ITopologyConfigurationSession configSession, ADObjectId serverId, bool skipForMaintenanceMode) { bool enabled = VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.CheckServerLocatorServersForMaintenanceMode.Enabled; bool enabled2 = VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.CheckServerOnlineForActiveServer.Enabled; ADPropertyDefinition[] properties; if (enabled) { properties = new ADPropertyDefinition[] { ActiveDirectoryServerSchema.DatabaseCopyAutoActivationPolicy, ServerSchema.ComponentStates, ActiveDirectoryServerSchema.DatabaseCopyActivationDisabledAndMoveNow }; } else if (enabled2) { properties = new ADPropertyDefinition[] { ActiveDirectoryServerSchema.DatabaseCopyAutoActivationPolicy, ServerSchema.ComponentStates }; } else { properties = new ADPropertyDefinition[] { ActiveDirectoryServerSchema.DatabaseCopyAutoActivationPolicy }; } MiniServer miniServer = configSession.ReadMiniServer(serverId, properties); if (miniServer == null) { this.Tracer.TraceDebug((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server is NULL."); return(null); } if (skipForMaintenanceMode) { if (miniServer.DatabaseCopyAutoActivationPolicy == DatabaseCopyAutoActivationPolicyType.Blocked) { this.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server {0} DatabaseCopyAutoActivationPolicy {1}.", miniServer.ToString(), miniServer.DatabaseCopyAutoActivationPolicy.ToString()); return(null); } if (enabled && miniServer.DatabaseCopyActivationDisabledAndMoveNow) { this.Tracer.TraceDebug <MiniServer, bool>((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server {0} DatabaseCopyActivationDisabledAndMoveNow is {1}.", miniServer, miniServer.DatabaseCopyActivationDisabledAndMoveNow); return(null); } if (enabled2 || enabled) { MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)miniServer[ServerSchema.ComponentStates]; if (!ServerComponentStates.IsServerOnline(multiValuedProperty)) { this.Tracer.TraceDebug <MiniServer, string>((long)this.GetHashCode(), "[MailboxServerLocator.GetActiveServer] return null. Server {0} ComponentStates {1}.", miniServer, (multiValuedProperty == null) ? "<NULL>" : string.Join(",", multiValuedProperty.ToArray())); return(null); } } } return(miniServer); }
protected override bool UpdateTargetMissingProperty(string sourceId, ADPropertyDefinition propertyDefinition, SyncLink link, ADRawEntry target) { string text = (string)target[SyncObjectSchema.ObjectId]; MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)target[ADObjectSchema.ObjectClass]; DirectoryObjectClass? directoryObjectClass = null; foreach (string key in multiValuedProperty) { if (this.directoryClassLookup.ContainsKey(key)) { directoryObjectClass = new DirectoryObjectClass?(this.directoryClassLookup[key]); break; } } if (directoryObjectClass == null) { ExTraceGlobals.BackSyncTracer.TraceError <string, string, string>((long)SyncConfiguration.TraceId, "LinkTargetMissingPropertyResolver:: - Skipping link {0} -> {1}. Unsupported link target class: {2}", sourceId, text, string.Join(",", multiValuedProperty.ToArray())); return(false); } if (propertyDefinition.LdapDisplayName == SyncGroupSchema.ManagedBy.LdapDisplayName && directoryObjectClass.Value == DirectoryObjectClass.Group) { ExTraceGlobals.BackSyncTracer.TraceError <string, string>((long)SyncConfiguration.TraceId, "LinkTargetMissingPropertyResolver:: - Skipping link {0} -> {1}. ManagedBy for groups pointing to groups need to be filtered out.", sourceId, text); return(false); } link.UpdateSyncData(text, directoryObjectClass.Value); return(true); }
private static void GetUMSettingsFromSourceUser(IRecipientSession tenantLocalRecipientSession, IConfigurationSession tenantLocalConfigSession, bool isDatacenter, ADUser sourceUser, ADUser targetUser, out UMMailboxPolicy targetPolicy, out UMDialPlan targetDialPlan, out MultiValuedProperty <string> targetUserExtensions, out string targetUserSipResourceIdentifier) { if (!Utils.UnifiedMessagingAvailable(targetUser)) { throw new UMNotAvailableForUserInTargetForestException(); } targetPolicy = MigrationHelper.GetTargetPolicy(tenantLocalConfigSession, sourceUser); targetDialPlan = tenantLocalConfigSession.Read <UMDialPlan>(targetPolicy.UMDialPlan); targetUserExtensions = MigrationHelper.GetTargetUserExtensions(sourceUser, targetDialPlan, out targetUserSipResourceIdentifier); LocalizedException ex; TelephoneNumberProcessStatus telephoneNumberProcessStatus; Utils.ValidateExtensionsAndSipResourceIdentifier(tenantLocalRecipientSession, tenantLocalConfigSession, isDatacenter, targetUser, targetDialPlan, targetUserExtensions.ToArray(), null, targetUserSipResourceIdentifier, out ex, out telephoneNumberProcessStatus); if (ex != null) { throw ex; } }