internal static object VersionsGetter(IPropertyBag propertyBag)
        {
            MultiValuedProperty <OfflineAddressBookVersion> multiValuedProperty = new MultiValuedProperty <OfflineAddressBookVersion>();
            object obj = propertyBag[OfflineAddressBookSchema.RawVersion];
            int    num = (int)(obj ?? OfflineAddressBookSchema.RawVersion.DefaultValue);

            if ((1 & num) != 0)
            {
                multiValuedProperty.Add(OfflineAddressBookVersion.Version1);
            }
            num = ~num;
            if ((2 & num) != 0)
            {
                multiValuedProperty.Add(OfflineAddressBookVersion.Version2);
            }
            if ((4 & num) != 0)
            {
                multiValuedProperty.Add(OfflineAddressBookVersion.Version3);
            }
            if ((8 & num) != 0)
            {
                multiValuedProperty.Add(OfflineAddressBookVersion.Version4);
            }
            return(multiValuedProperty);
        }
 internal static void UpdateMetabase(ADOabVirtualDirectory virtualDirectory, bool updateAuthenticationMethod, Task.TaskErrorLoggingDelegate handler)
 {
     try
     {
         DirectoryEntry directoryEntry2;
         DirectoryEntry directoryEntry = directoryEntry2 = IisUtility.CreateIISDirectoryEntry(virtualDirectory.MetabasePath);
         try
         {
             ArrayList arrayList = new ArrayList();
             int       num       = (int)(IisUtility.GetIisPropertyValue("AccessSSLFlags", IisUtility.GetProperties(directoryEntry)) ?? 0);
             if (virtualDirectory.RequireSSL)
             {
                 num |= 8;
             }
             else
             {
                 num &= -9;
                 num &= -257;
                 num &= -65;
             }
             arrayList.Add(new MetabaseProperty("AccessSSLFlags", num, true));
             if (updateAuthenticationMethod)
             {
                 uint num2 = (uint)((int)(IisUtility.GetIisPropertyValue("AuthFlags", IisUtility.GetProperties(directoryEntry)) ?? 0));
                 num2 |= 4U;
                 num2 &= 4294967294U;
                 arrayList.Add(new MetabaseProperty("AuthFlags", num2, true));
                 MultiValuedProperty <AuthenticationMethod> multiValuedProperty = new MultiValuedProperty <AuthenticationMethod>();
                 multiValuedProperty.Add(AuthenticationMethod.WindowsIntegrated);
                 if (IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Basic))
                 {
                     multiValuedProperty.Add(AuthenticationMethod.Basic);
                 }
                 if (IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Digest))
                 {
                     multiValuedProperty.Add(AuthenticationMethod.Digest);
                 }
                 if (IisUtility.CheckForAuthenticationMethod(directoryEntry, AuthenticationMethodFlags.Fba))
                 {
                     multiValuedProperty.Add(AuthenticationMethod.Fba);
                 }
                 virtualDirectory.ExternalAuthenticationMethods = (virtualDirectory.InternalAuthenticationMethods = multiValuedProperty);
             }
             IisUtility.SetProperties(directoryEntry, arrayList);
             directoryEntry.CommitChanges();
             IisUtility.CommitMetabaseChanges((virtualDirectory.Server == null) ? null : virtualDirectory.Server.ToString());
         }
         finally
         {
             if (directoryEntry2 != null)
             {
                 ((IDisposable)directoryEntry2).Dispose();
             }
         }
     }
     catch (COMException exception)
     {
         handler(exception, ErrorCategory.InvalidOperation, virtualDirectory.Identity);
     }
 }
Example #3
0
        // Token: 0x060055F4 RID: 22004 RVA: 0x00135E34 File Offset: 0x00134034
        internal static MultiValuedProperty <SecurityIdentifier> PublicToGroupSidsGetter(IPropertyBag propertyBag)
        {
            MultiValuedProperty <ADObjectId>         multiValuedProperty   = (MultiValuedProperty <ADObjectId>)propertyBag[GroupMailboxSchema.DelegateListLink];
            ModernGroupObjectType                    modernGroupObjectType = (ModernGroupObjectType)propertyBag[GroupMailboxSchema.ModernGroupType];
            MultiValuedProperty <SecurityIdentifier> multiValuedProperty2  = new MultiValuedProperty <SecurityIdentifier>();

            if (multiValuedProperty != null && multiValuedProperty.Count > 0)
            {
                using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ADObjectId         instance           = enumerator.Current;
                        SecurityIdentifier securityIdentifier = ADObjectId.GetSecurityIdentifier(instance);
                        if (securityIdentifier != null)
                        {
                            multiValuedProperty2.Add(securityIdentifier);
                        }
                    }
                    return(multiValuedProperty2);
                }
            }
            if (modernGroupObjectType == ModernGroupObjectType.Public)
            {
                SecurityIdentifier item = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
                multiValuedProperty2.Add(item);
            }
            return(multiValuedProperty2);
        }
        private void SetTaskCondition(AuditOperationsPredicate condition)
        {
            MultiValuedProperty <AuditableOperations> multiValuedProperty = new MultiValuedProperty <AuditableOperations>();

            if (condition != null && condition.Value != null && condition.Value.ParsedValue != null)
            {
                if (condition.Value.ParsedValue is string)
                {
                    AuditableOperations item;
                    if (Enum.TryParse <AuditableOperations>((string)condition.Value.ParsedValue, true, out item))
                    {
                        multiValuedProperty.Add(item);
                    }
                }
                else if (condition.Value.ParsedValue is List <string> )
                {
                    foreach (string text in ((List <string>)condition.Value.ParsedValue))
                    {
                        AuditableOperations item;
                        if (text != null && Enum.TryParse <AuditableOperations>(text, true, out item))
                        {
                            multiValuedProperty.Add(item);
                        }
                    }
                }
            }
            this.AuditOperation = multiValuedProperty;
        }
        public static MultiValuedProperty <string> UpdateRemoteState(MultiValuedProperty <string> componentStates, string requester, string component, ServiceState state)
        {
            if (!ServerComponentStates.IsValidName(component))
            {
                throw new ArgumentException(DirectoryStrings.ComponentNameInvalid);
            }
            if (!ServerComponentStates.IsValidName(requester))
            {
                throw new ArgumentException(DirectoryStrings.RequesterNameInvalid);
            }
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            if (componentStates != null)
            {
                foreach (string text in componentStates)
                {
                    ServerComponentStates.ItemEntry itemEntry;
                    if (ServerComponentStates.TryParseRemoteStateString(text, out itemEntry) && (!string.Equals(itemEntry.Component, component, StringComparison.OrdinalIgnoreCase) || !string.Equals(itemEntry.Requester, requester, StringComparison.OrdinalIgnoreCase)))
                    {
                        multiValuedProperty.Add(text);
                    }
                }
            }
            multiValuedProperty.Add(string.Format("1:{0}:{1}:{2}:{3}", new object[]
            {
                component,
                requester,
                (int)state,
                DateTime.UtcNow.Ticks
            }));
            return(multiValuedProperty);
        }
Example #6
0
        public IOutboundConnector BuildExpectedOutboundConnector(ADObjectId identity, string name, string tlsCertificateSubjectDomainName, MultiValuedProperty <SmtpDomain> hybridDomains, string smartHost, bool centralizedTransportFeatureEnabled)
        {
            MultiValuedProperty <SmtpDomainWithSubdomains> multiValuedProperty = new MultiValuedProperty <SmtpDomainWithSubdomains>();

            if (centralizedTransportFeatureEnabled)
            {
                multiValuedProperty.Add(new SmtpDomainWithSubdomains("*"));
            }
            else
            {
                foreach (SmtpDomainWithSubdomains item in from s in hybridDomains
                         select new SmtpDomainWithSubdomains(s.Domain))
                {
                    multiValuedProperty.Add(item);
                }
            }
            MultiValuedProperty <SmartHost> smartHosts = new MultiValuedProperty <SmartHost>
            {
                new SmartHost(smartHost)
            };

            return(new OutboundConnector(name, tlsCertificateSubjectDomainName, multiValuedProperty, smartHosts, centralizedTransportFeatureEnabled)
            {
                Identity = identity
            });
        }
Example #7
0
        // Token: 0x060019C4 RID: 6596 RVA: 0x0006CB4C File Offset: 0x0006AD4C
        internal static object ManagedByGetter(IPropertyBag propertyBag)
        {
            object result;

            try
            {
                ADObjectId adobjectId = propertyBag[ADGroupSchema.RawManagedBy] as ADObjectId;
                MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>();
                if (adobjectId != null)
                {
                    multiValuedProperty.Add(adobjectId);
                }
                MultiValuedProperty <ADObjectId> multiValuedProperty2 = propertyBag[ADGroupSchema.CoManagedBy] as MultiValuedProperty <ADObjectId>;
                foreach (ADObjectId item in multiValuedProperty2)
                {
                    if (!multiValuedProperty.Contains(item))
                    {
                        multiValuedProperty.Add(item);
                    }
                }
                multiValuedProperty.ResetChangeTracking();
                result = multiValuedProperty;
            }
            catch (InvalidOperationException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("ManagedBy", ex.Message), ADGroupSchema.ManagedBy, propertyBag[ADGroupSchema.RawManagedBy]), ex);
            }
            return(result);
        }
        // Token: 0x06000E86 RID: 3718 RVA: 0x00045CC0 File Offset: 0x00043EC0
        private static MultiValuedProperty <string> ConvertStringArrayToMvpString(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            MultiValuedProperty <string> multiValuedProperty = new MultiValuedProperty <string>();

            if (obj is string)
            {
                multiValuedProperty.Add((string)obj);
            }
            else if (obj is string[])
            {
                string[] array = (string[])obj;
                foreach (string text in array)
                {
                    if (text != null)
                    {
                        multiValuedProperty.Add(text);
                    }
                }
            }
            return(multiValuedProperty);
        }
        private void SetMultiValuedProperty <T, V>(MultiValuedProperty <T> inputValues, MultiValuedProperty <V> existingValues, SetOrganizationConfig.Resolver <T, V> resolver)
        {
            if (inputValues == null)
            {
                existingValues.Clear();
                return;
            }
            if (!inputValues.IsChangesOnlyCopy)
            {
                existingValues.Clear();
                using (IEnumerator <V> enumerator = resolver(inputValues).Distinct <V>().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        V item = enumerator.Current;
                        existingValues.Add(item);
                    }
                    return;
                }
            }
            HashSet <V>     first   = new HashSet <V>(existingValues);
            IEnumerable <V> second  = resolver(inputValues.Added.Cast <T>());
            IEnumerable <V> second2 = resolver(inputValues.Removed.Cast <T>());

            existingValues.Clear();
            foreach (V item2 in first.Union(second).Except(second2))
            {
                existingValues.Add(item2);
            }
        }
Example #10
0
        public static MultiValuedProperty <PublicFolderAccessRight> CreatePublicFolderAccessRightCollection(PublicFolderPermission permission)
        {
            permission &= (PublicFolderPermission.ReadItems | PublicFolderPermission.CreateItems | PublicFolderPermission.EditOwnedItems | PublicFolderPermission.DeleteOwnedItems | PublicFolderPermission.EditAllItems | PublicFolderPermission.DeleteAllItems | PublicFolderPermission.CreateSubfolders | PublicFolderPermission.FolderOwner | PublicFolderPermission.FolderContact | PublicFolderPermission.FolderVisible);
            MultiValuedProperty <PublicFolderAccessRight> multiValuedProperty = new MultiValuedProperty <PublicFolderAccessRight>();

            if (Enum.IsDefined(typeof(PublicFolderPermission), permission) || Enum.IsDefined(typeof(PublicFolderPermissionRole), (int)permission))
            {
                multiValuedProperty.Add(new PublicFolderAccessRight(permission));
            }
            else
            {
                int num  = (int)permission;
                int num2 = 1;
                int num3 = 0;
                while (24 > num3)
                {
                    if ((num2 & num) != 0 && Enum.IsDefined(typeof(PublicFolderPermission), num2))
                    {
                        multiValuedProperty.Add(new PublicFolderAccessRight((PublicFolderPermission)num2));
                    }
                    num2 <<= 1;
                    num3++;
                }
            }
            return(multiValuedProperty);
        }
        internal void UpdateRawMapiAttributes(bool movingToPreE14Server)
        {
            MultiValuedProperty <OfflineAddressBookMapiProperty> multiValuedProperty  = (MultiValuedProperty <OfflineAddressBookMapiProperty>) this.propertyBag[OfflineAddressBookSchema.ConfiguredAttributes];
            MultiValuedProperty <OfflineAddressBookMapiProperty> multiValuedProperty2 = new MultiValuedProperty <OfflineAddressBookMapiProperty>();

            foreach (OfflineAddressBookMapiProperty offlineAddressBookMapiProperty in multiValuedProperty)
            {
                offlineAddressBookMapiProperty.ResolveMapiPropTag();
                if (multiValuedProperty2.Contains(offlineAddressBookMapiProperty))
                {
                    throw new ArgumentException(DirectoryStrings.ErrorDuplicateMapiIdsInConfiguredAttributes);
                }
                multiValuedProperty2.Add(offlineAddressBookMapiProperty);
            }
            MultiValuedProperty <int> multiValuedProperty3 = new MultiValuedProperty <int>();
            MultiValuedProperty <int> multiValuedProperty4 = new MultiValuedProperty <int>();
            MultiValuedProperty <int> multiValuedProperty5 = new MultiValuedProperty <int>();

            foreach (OfflineAddressBookMapiProperty offlineAddressBookMapiProperty2 in multiValuedProperty2)
            {
                switch (offlineAddressBookMapiProperty2.Type)
                {
                case OfflineAddressBookMapiPropertyOption.ANR:
                    multiValuedProperty3.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;

                case OfflineAddressBookMapiPropertyOption.Value:
                    multiValuedProperty4.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;

                case OfflineAddressBookMapiPropertyOption.Indicator:
                    multiValuedProperty5.Add((int)offlineAddressBookMapiProperty2.PropertyTag);
                    break;
                }
            }
            if (multiValuedProperty3.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty3.Add(0);
            }
            if (multiValuedProperty4.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty4.Add(0);
            }
            if (multiValuedProperty5.Count == 0 && !movingToPreE14Server)
            {
                multiValuedProperty5.Add(0);
            }
            this.propertyBag[OfflineAddressBookSchema.ANRProperties]       = multiValuedProperty3;
            this.propertyBag[OfflineAddressBookSchema.DetailsProperties]   = multiValuedProperty4;
            this.propertyBag[OfflineAddressBookSchema.TruncatedProperties] = multiValuedProperty5;
            if (multiValuedProperty.IsReadOnly)
            {
                this.propertyBag.SetField(OfflineAddressBookSchema.ConfiguredAttributes, new MultiValuedProperty <OfflineAddressBookMapiProperty>());
                return;
            }
            multiValuedProperty.Clear();
            multiValuedProperty.ResetChangeTracking();
        }
        private static void AuthSchemeSetter(object value, IPropertyBag propertyBag)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[AuthRedirectSchema.Keywords];

            multiValuedProperty.Clear();
            string item = value.ToString();

            multiValuedProperty.Add(AuthRedirect.AuthRedirectKeywords);
            multiValuedProperty.Add(item);
        }
Example #13
0
 protected override void SetTaskConditions(IEnumerable <Condition> conditions)
 {
     foreach (Condition condition in conditions)
     {
         if (condition.GetType() == typeof(NameValuesPairConfigurationPredicate) || condition.GetType() == typeof(IsPredicate))
         {
             IsPredicate isPredicate = condition as IsPredicate;
             if (isPredicate != null)
             {
                 MultiValuedProperty <Guid> multiValuedProperty = new MultiValuedProperty <Guid>();
                 if (isPredicate.Property.Name.Equals("ExclusionList"))
                 {
                     if (isPredicate.Value.ParsedValue is Guid)
                     {
                         multiValuedProperty.Add(isPredicate.Value.ParsedValue);
                     }
                     if (isPredicate.Value.ParsedValue is List <Guid> )
                     {
                         foreach (string item in ((List <string>)isPredicate.Value.ParsedValue))
                         {
                             multiValuedProperty.Add(item);
                         }
                     }
                     this.ExclusionList = multiValuedProperty;
                 }
             }
             else
             {
                 NameValuesPairConfigurationPredicate nameValuesPairConfigurationPredicate = condition as NameValuesPairConfigurationPredicate;
                 if (nameValuesPairConfigurationPredicate != null)
                 {
                     bool value2;
                     if (nameValuesPairConfigurationPredicate.Property.Name.Equals(DeviceTenantRule.AccessControl_ResourceScope))
                     {
                         PolicyResourceScope value;
                         if (Enum.TryParse <PolicyResourceScope>(nameValuesPairConfigurationPredicate.Value.RawValues.FirstOrDefault <string>(), out value))
                         {
                             this.ApplyPolicyTo = new PolicyResourceScope?(value);
                         }
                     }
                     else if (nameValuesPairConfigurationPredicate.Property.Name.Equals(DeviceTenantRule.AccessControl_AllowActionOnUnsupportedPlatform) && bool.TryParse(nameValuesPairConfigurationPredicate.Value.RawValues.FirstOrDefault <string>(), out value2))
                     {
                         this.BlockUnsupportedDevices = new bool?(value2);
                     }
                 }
             }
         }
     }
 }
Example #14
0
        protected override IConfigurable PrepareDataObject()
        {
            QueryFilter           filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, "Internet Message Formats");
            IConfigurationSession configurationSession = (IConfigurationSession)base.DataSession;

            configurationSession.SessionSettings.IsSharedConfigChecked = true;
            ADObjectId childId = configurationSession.GetOrgContainerId().GetChildId("Global Settings");

            ContentConfigContainer[] array = configurationSession.Find <ContentConfigContainer>(childId, QueryScope.OneLevel, filter, null, 0);
            ContentConfigContainer   contentConfigContainer;

            if (this.isContainerExisted = (array != null && array.Length > 0))
            {
                contentConfigContainer = array[0];
            }
            else
            {
                contentConfigContainer = (ContentConfigContainer)base.PrepareDataObject();
                contentConfigContainer.SetId(childId.GetChildId("Internet Message Formats"));
                MultiValuedProperty <string> mimeTypes = contentConfigContainer.MimeTypes;
                foreach (string item in InstallInternetMessageFormat.newTypes)
                {
                    if (!mimeTypes.Contains(item))
                    {
                        mimeTypes.Add(item);
                    }
                }
                contentConfigContainer.MimeTypes = mimeTypes;
            }
            return(contentConfigContainer);
        }
Example #15
0
 public static void InsertDomain(this MultiValuedProperty <SmtpDomainWithSubdomains> domainsList, SmtpDomainWithSubdomains domain)
 {
     if (domainsList != null && domain != null && !domainsList.Contains(domain))
     {
         domainsList.Add(domain);
     }
 }
Example #16
0
        internal static void ResolveModifiedMultiReferenceParameter <TIdentityParameter>(string parameterName, object propertyBagKey, IEnumerable <TIdentityParameter> parameters, GetRecipientDelegate <TIdentityParameter> getRecipient, IReferenceErrorReporter referenceErrorReporter, Dictionary <object, MultiValuedProperty <ADObjectId> > recipientIdsDictionary, Dictionary <object, MultiValuedProperty <ADRecipient> > recipientsDictionary, Dictionary <ADRecipient, IIdentityParameter> parameterDictionary) where TIdentityParameter : IIdentityParameter
        {
            MultiValuedProperty <ADRecipient> recipients   = null;
            MultiValuedProperty <ADObjectId>  recipientIds = null;

            if (parameters != null)
            {
                recipients   = new MultiValuedProperty <ADRecipient>();
                recipientIds = new MultiValuedProperty <ADObjectId>();
                using (IEnumerator <TIdentityParameter> enumerator = parameters.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        TIdentityParameter parameter      = enumerator.Current;
                        string             parameterName2 = parameterName;
                        TIdentityParameter parameter2     = parameter;
                        referenceErrorReporter.ValidateReference(parameterName2, parameter2.RawIdentity, delegate(Task.ErrorLoggerDelegate writeError)
                        {
                            ADRecipient adrecipient = getRecipient(parameter, writeError);
                            if (recipientIds.Contains((ADObjectId)adrecipient.Identity))
                            {
                                writeError(new RecipientTaskException(Strings.ErrorRecipientIdParamElementsNotUnique(parameterName, adrecipient.Id.ToString())), ExchangeErrorCategory.Client, parameter);
                            }
                            recipientIds.Add(adrecipient.Identity);
                            recipients.Add(adrecipient);
                            parameterDictionary.Add(adrecipient, parameter);
                        });
                    }
                }
            }
            recipientsDictionary[propertyBagKey]   = recipients;
            recipientIdsDictionary[propertyBagKey] = recipientIds;
        }
        // Token: 0x06001D48 RID: 7496 RVA: 0x00079EF8 File Offset: 0x000780F8
        private static void InternalStringValuesSetter(object value, IPropertyBag propertyBag, ADPropertyDefinition filterMeatadata, string filterPrefix)
        {
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[filterMeatadata];

            RecipientFilterHelper.ClearNonExchange12RecipientFilterMetadata(multiValuedProperty);
            int num = multiValuedProperty.Count - 1;

            while (0 <= num)
            {
                if (multiValuedProperty[num].StartsWith(filterPrefix, StringComparison.OrdinalIgnoreCase))
                {
                    multiValuedProperty.RemoveAt(num);
                }
                num--;
            }
            MultiValuedProperty <string> multiValuedProperty2 = (MultiValuedProperty <string>)value;

            if (multiValuedProperty2 != null && multiValuedProperty2.Count != 0)
            {
                foreach (string text in multiValuedProperty2)
                {
                    if (!string.IsNullOrEmpty(text))
                    {
                        multiValuedProperty.Add(filterPrefix + text);
                    }
                }
            }
        }
Example #18
0
        internal static void AddModifiedRecipientIds(object sourceBagProperty, PropertyDefinition targetBagProperty, ADObject targetObject, Dictionary <object, MultiValuedProperty <ADObjectId> > recipientIdsDictionary, Func <ADGroup, ADObjectId, IConfigDataProvider, bool> memberExistingCheck, IConfigDataProvider session)
        {
            MultiValuedProperty <ADObjectId> multiValuedProperty = recipientIdsDictionary[sourceBagProperty];

            if (multiValuedProperty != null && multiValuedProperty.Count > 0)
            {
                if (targetObject[targetBagProperty] == null)
                {
                    targetObject[targetBagProperty] = new MultiValuedProperty <ADObjectId>();
                }
                MultiValuedProperty <ADObjectId> multiValuedProperty2 = targetObject[targetBagProperty] as MultiValuedProperty <ADObjectId>;
                foreach (ADObjectId adobjectId in multiValuedProperty)
                {
                    if (memberExistingCheck != null)
                    {
                        if (memberExistingCheck((ADGroup)targetObject, adobjectId, session))
                        {
                            continue;
                        }
                    }
                    else if (multiValuedProperty2.Contains(adobjectId))
                    {
                        continue;
                    }
                    multiValuedProperty2.Add(adobjectId);
                }
            }
        }
Example #19
0
        internal static MultiValuedProperty <ADObjectId> ValidateAddressBook(IConfigDataProvider session, AddressListIdParameter[] addressBooks, AddressBookPolicyTaskUtility.GetUniqueObject getAddressBook, AddressBookMailboxPolicy target, Task.TaskErrorLoggingDelegate writeError)
        {
            MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, AddressBookMailboxPolicySchema.AddressLists, new object[0]);

            if (addressBooks != null)
            {
                foreach (AddressListIdParameter addressListIdParameter in addressBooks)
                {
                    if (addressListIdParameter != null)
                    {
                        IConfigurable configurable = getAddressBook(addressListIdParameter, session, null, new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotFound(addressListIdParameter.ToString())), new LocalizedString?(Strings.ErrorAddressListOrGlobalAddressListNotUnique(addressListIdParameter.ToString())));
                        if (configurable != null)
                        {
                            if (multiValuedProperty.Contains((ADObjectId)configurable.Identity))
                            {
                                writeError(new InvalidOperationException(Strings.ErrorOabALAlreadyAssigned((target.Identity != null) ? target.Identity.ToString() : target.Name, configurable.Identity.ToString())), ErrorCategory.InvalidOperation, target.Identity);
                            }
                            else
                            {
                                multiValuedProperty.Add((ADObjectId)configurable.Identity);
                            }
                        }
                    }
                }
            }
            return(multiValuedProperty);
        }
        internal static object RecipientDomainsGetter(IPropertyBag propertyBag)
        {
            MultiValuedProperty <SmtpDomainWithSubdomains> multiValuedProperty = null;
            MultiValuedProperty <string> multiValuedProperty2 = (MultiValuedProperty <string>)propertyBag[TenantOutboundConnectorSchema.RecipientDomains];

            if (multiValuedProperty2 != null)
            {
                multiValuedProperty = new MultiValuedProperty <SmtpDomainWithSubdomains>();
                foreach (string text in multiValuedProperty2)
                {
                    SmtpDomainWithSubdomains smtpDomainWithSubdomains = null;
                    if (!SmtpDomainWithSubdomains.TryParse(text, out smtpDomainWithSubdomains))
                    {
                        AddressSpace addressSpace = null;
                        if (AddressSpace.TryParse(text, out addressSpace) && addressSpace.IsSmtpType)
                        {
                            smtpDomainWithSubdomains = addressSpace.DomainWithSubdomains;
                        }
                    }
                    if (smtpDomainWithSubdomains != null)
                    {
                        multiValuedProperty.Add(smtpDomainWithSubdomains);
                    }
                }
            }
            return(multiValuedProperty);
        }
Example #21
0
        private void SaveTemplate(CancelEventArgs e)
        {
            TabControl templateTab = this.templatePage.TemplateSurface.TemplateTab;
            MultiValuedProperty <Page> multiValuedProperty = new MultiValuedProperty <Page>();

            foreach (object obj in templateTab.TabPages)
            {
                CustomTabPage customTabPage      = (CustomTabPage)obj;
                Page          detailsTemplateTab = customTabPage.DetailsTemplateTab;
                detailsTemplateTab.Controls.Clear();
                DetailsTemplatesSurface.SortControls(customTabPage, true);
                foreach (object obj2 in customTabPage.Controls)
                {
                    Control control = (Control)obj2;
                    DetailsTemplateControl detailsTemplateControl = (control as IDetailsTemplateControlBound).DetailsTemplateControl;
                    detailsTemplateTab.Controls.Add(detailsTemplateControl);
                }
                DetailsTemplatesSurface.SortControls(customTabPage, false);
                multiValuedProperty.Add(detailsTemplateTab);
            }
            DetailsTemplate detailsTemplate = this.templatePage.BindingSource.DataSource as DetailsTemplate;

            detailsTemplate.Pages = multiValuedProperty;
            if (this.templatePage.DataHandler != null)
            {
                this.templatePage.DataHandler.SpecifyParameterNames("Pages");
            }
            this.templatePage.Apply(e);
            this.RefreshOnFinish.Refresh(base.CreateProgress(Strings.Refreshing));
        }
        public override void WriteCookie(byte[] cookie, DateTime timestamp)
        {
            if (cookie == null || cookie.Length == 0)
            {
                throw new ArgumentException("cookie is empty");
            }
            MsoTenantCookieContainer msoTenantCookieContainer = this.configSession.GetMsoTenantCookieContainer(base.ContextId);

            if (msoTenantCookieContainer != null)
            {
                int cookieVersion = (base.LastCookie != null) ? base.LastCookie.Version : 1;
                MsoFullSyncCookie msoFullSyncCookie = new MsoFullSyncCookie(cookie, cookieVersion);
                msoFullSyncCookie.Timestamp = timestamp;
                if (base.LastCookie != null)
                {
                    msoFullSyncCookie.SyncType          = base.LastCookie.SyncType;
                    msoFullSyncCookie.SyncRequestor     = base.LastCookie.SyncRequestor;
                    msoFullSyncCookie.WhenSyncRequested = base.LastCookie.WhenSyncRequested;
                    msoFullSyncCookie.WhenSyncStarted   = ((base.LastCookie.WhenSyncStarted != DateTime.MinValue) ? base.LastCookie.WhenSyncStarted : timestamp);
                }
                byte[] item = msoFullSyncCookie.ToStorageCookie();
                MultiValuedProperty <byte[]> multiValuedProperty = this.RetrievePersistedPageTokens(msoTenantCookieContainer);
                multiValuedProperty.Clear();
                multiValuedProperty.Add(item);
                this.configSession.Save(msoTenantCookieContainer);
                this.LogPersistPageTokenEvent();
            }
        }
Example #23
0
        internal static void MultiValuedBytesKeySetter(object value, IPropertyBag propertyBag, ADPropertyDefinition rawProperty, int offset)
        {
            MultiValuedProperty <byte[]> multiValuedProperty = propertyBag[rawProperty] as MultiValuedProperty <byte[]>;
            string text = value as string;

            if (string.IsNullOrEmpty(text))
            {
                if (offset > multiValuedProperty.Count - 1)
                {
                    return;
                }
                if (offset == multiValuedProperty.Count - 1)
                {
                    multiValuedProperty.RemoveAt(offset);
                    return;
                }
            }
            while (multiValuedProperty.Count < offset + 1)
            {
                MultiValuedProperty <byte[]> multiValuedProperty2 = multiValuedProperty;
                byte[] item = new byte[1];
                multiValuedProperty2.Add(item);
            }
            if (!string.IsNullOrEmpty(text))
            {
                multiValuedProperty[offset] = Convert.FromBase64String(text);
                return;
            }
            MultiValuedProperty <byte[]> multiValuedProperty3 = multiValuedProperty;

            byte[] value2 = new byte[1];
            multiValuedProperty3[offset] = value2;
        }
Example #24
0
        internal static object LanguagesGetter(IPropertyBag propertyBag)
        {
            string text = (string)propertyBag[ADOrgPersonSchema.LanguagesRaw];
            MultiValuedProperty <CultureInfo> multiValuedProperty = new MultiValuedProperty <CultureInfo>();

            if (!string.IsNullOrEmpty(text))
            {
                string[] array = text.Split(new char[]
                {
                    ','
                });
                for (int i = 0; i < array.Length; i++)
                {
                    CultureInfo cultureInfo = null;
                    try
                    {
                        cultureInfo = new CultureInfo(array[i].Trim());
                    }
                    catch (ArgumentException ex)
                    {
                        ExTraceGlobals.ADReadDetailsTracer.TraceDebug <string, string>(0L, "ADOrgPerson::LanguagesGetter - Invalid culture {0} ignored. Exception: {1}", array[i], ex.Message);
                    }
                    if (cultureInfo != null)
                    {
                        multiValuedProperty.Add(cultureInfo);
                    }
                }
            }
            return(multiValuedProperty);
        }
Example #25
0
        public MultiValuedProperty <BindingMetadata> ValidateLocations(IEnumerable <string> locations)
        {
            ArgumentValidator.ThrowIfNull("locations", locations);
            MultiValuedProperty <BindingMetadata> multiValuedProperty = new MultiValuedProperty <BindingMetadata>();

            if (locations.Count <string>() > this.maxSitesLimit)
            {
                base.LogOneEntry(ExecutionLog.EventType.Error, "InvalidArgument: {0}", new object[]
                {
                    Strings.ErrorMaxSiteLimit(this.maxSitesLimit, locations.Count <string>())
                });
                base.WriteError(new SpValidatorException(Strings.ErrorMaxSiteLimit(this.maxSitesLimit, locations.Count <string>())), ErrorCategory.InvalidArgument);
            }
            foreach (string location in locations)
            {
                SharepointValidationResult validationResult = this.ValidateLocation(location);
                if (validationResult.IsValid)
                {
                    if (validationResult.IsTopLevelSiteCollection)
                    {
                        base.WriteWarning(validationResult.ValidationText);
                    }
                    if (!multiValuedProperty.Any((BindingMetadata p) => string.Equals(validationResult.SharepointSource.Identity, p.ImmutableIdentity, StringComparison.OrdinalIgnoreCase)))
                    {
                        multiValuedProperty.Add(new BindingMetadata(validationResult.SharepointSource.Title, validationResult.SharepointSource.SiteUrl, validationResult.SharepointSource.Identity, SourceValidator.GetBindingType(validationResult.SharepointSource.Identity)));
                    }
                }
                else
                {
                    base.WriteError(new SpValidatorException(validationResult.ValidationText), ErrorCategory.InvalidArgument);
                }
            }
            return(multiValuedProperty);
        }
        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);
        }
        public static MultiValuedProperty <CredentialRecord> Load(Server edgeServer)
        {
            ITopologyConfigurationSession          configurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 103, "Load", "f:\\15.00.1497\\sources\\dev\\EdgeSync\\src\\Common\\Validation\\CredentialRecord.cs");
            MultiValuedProperty <CredentialRecord> credentialRecords    = new MultiValuedProperty <CredentialRecord>();

            ADNotificationAdapter.TryReadConfigurationPaged <Server>(() => configurationSession.FindAllServersWithVersionNumber(Server.E2007MinVersion), delegate(Server server)
            {
                if (server.IsHubTransportServer && server.EdgeSyncCredentials != null && server.EdgeSyncCredentials.Count != 0)
                {
                    foreach (byte[] data in server.EdgeSyncCredentials)
                    {
                        EdgeSyncCredential edgeSyncCredential = EdgeSyncCredential.DeserializeEdgeSyncCredential(data);
                        if (edgeSyncCredential.EdgeServerFQDN.Equals(edgeServer.Fqdn, StringComparison.OrdinalIgnoreCase))
                        {
                            CredentialRecord credentialRecord     = new CredentialRecord();
                            credentialRecord.TargetEdgeServerFQDN = edgeSyncCredential.EdgeServerFQDN;
                            credentialRecord.ESRAUsername         = edgeSyncCredential.ESRAUsername;
                            credentialRecord.EffectiveDate        = new DateTime(edgeSyncCredential.EffectiveDate).ToLocalTime();
                            credentialRecord.Duration             = new TimeSpan(edgeSyncCredential.Duration);
                            credentialRecord.IsBootStrapAccount   = edgeSyncCredential.IsBootStrapAccount;
                            credentialRecords.Add(credentialRecord);
                        }
                    }
                }
            });
            return(credentialRecords);
        }
        internal static void QuotaSettingSetter(ADPropertyDefinition adPropertyDefinition, object quota, IPropertyBag propertyBag)
        {
            if (adPropertyDefinition == null)
            {
                throw new ArgumentNullException("adPropertyDefinition");
            }
            MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)propertyBag[DataClassificationConfigSchema.DataClassificationConfigQuotaSettings];
            string text = adPropertyDefinition.Name + ':';

            if (multiValuedProperty != null && multiValuedProperty.Count != 0)
            {
                for (int i = multiValuedProperty.Count - 1; i >= 0; i--)
                {
                    if (string.IsNullOrEmpty(multiValuedProperty[i]) || multiValuedProperty[i].StartsWith(text, StringComparison.Ordinal))
                    {
                        multiValuedProperty.RemoveAt(i);
                    }
                }
            }
            if (!object.Equals(quota, adPropertyDefinition.DefaultValue))
            {
                string arg  = ValueConvertor.ConvertValueToString(quota, null);
                string item = string.Format("{0}{1}", text, arg);
                multiValuedProperty.Add(item);
            }
            propertyBag[DataClassificationConfigSchema.DataClassificationConfigQuotaSettings] = multiValuedProperty;
        }
Example #29
0
        public static void SetOutboundSpamFilterPreAction(DataRow inputRow, DataTable dataTable, DataObjectStore store)
        {
            DataRow       row             = dataTable.Rows[0];
            List <string> modifiedColumns = new List <string>();

            Antispam.outboundEmailListParameters.ForEach(delegate(string p)
            {
                string text = string.Format("str{0}", p);
                if (!DBNull.Value.Equals(row[text]))
                {
                    string[] array = row[text].ToString().Split(new char[]
                    {
                        ';'
                    }, StringSplitOptions.RemoveEmptyEntries);
                    MultiValuedProperty <SmtpAddress> multiValuedProperty = new MultiValuedProperty <SmtpAddress>();
                    foreach (string text2 in array)
                    {
                        multiValuedProperty.Add(new SmtpAddress(text2.Trim()));
                    }
                    inputRow[text] = multiValuedProperty;
                    modifiedColumns.Add(text);
                }
            });
            if (modifiedColumns.Count > 0)
            {
                store.SetModifiedColumns(modifiedColumns);
            }
        }
 // Token: 0x060009EB RID: 2539 RVA: 0x0002CBE4 File Offset: 0x0002ADE4
 internal static void SetSKUCapability(Capability?skuCapability, MultiValuedProperty <Capability> capabilities)
 {
     if (skuCapability != null && !CapabilityHelper.RootSKUCapabilities.Contains(skuCapability.Value))
     {
         throw new ArgumentOutOfRangeException("skuCapability", skuCapability.Value, DirectoryStrings.ExArgumentOutOfRangeException("skuCapability", skuCapability.Value));
     }
     if (skuCapability != null && capabilities.Contains(skuCapability.Value))
     {
         return;
     }
     if (capabilities.Count > 0)
     {
         foreach (Capability item in CapabilityHelper.RootSKUCapabilities)
         {
             capabilities.Remove(item);
             if (capabilities.Count == 0)
             {
                 break;
             }
         }
     }
     if (skuCapability != null)
     {
         capabilities.Add(skuCapability.Value);
     }
 }