Ejemplo n.º 1
0
        internal static bool GetOwnerId(ADRawEntry rawEntry, out ADABObjectId ownerId)
        {
            object obj;

            if (!rawEntry.TryGetValueWithoutDefault(ADGroupSchema.ManagedBy, out obj))
            {
                ownerId = null;
                return(false);
            }
            if (obj == null)
            {
                ownerId = null;
                return(true);
            }
            MultiValuedProperty <ADObjectId> multiValuedProperty = (MultiValuedProperty <ADObjectId>)obj;

            using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    ADObjectId activeDirectoryObjectId = enumerator.Current;
                    ownerId = new ADABObjectId(activeDirectoryObjectId);
                    return(true);
                }
            }
            ownerId = null;
            return(true);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 internal static void ValidateSenderIPAddressRestrictions(MultiValuedProperty <IPRange> addressRanges, MultiValuedProperty <IPRange> ffoDCIPs, MultiValuedProperty <ServiceProviderSettings> serviceProviders, Task task)
 {
     if (MultiValuedPropertyBase.IsNullOrEmpty(addressRanges))
     {
         return;
     }
     using (MultiValuedProperty <IPRange> .Enumerator enumerator = addressRanges.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             IPRange ipRange = enumerator.Current;
             if (!MultiValuedPropertyBase.IsNullOrEmpty(ffoDCIPs))
             {
                 if (ffoDCIPs.Any((IPRange ffoDCIP) => ffoDCIP.Overlaps(ipRange)))
                 {
                     task.WriteError(new SenderIPAddressOverlapsFfoDCIPAddressesException(ipRange.Expression), ErrorCategory.InvalidArgument, null);
                 }
             }
             if (!MultiValuedPropertyBase.IsNullOrEmpty(serviceProviders))
             {
                 if (serviceProviders.Any((ServiceProviderSettings serviceProvider) => serviceProvider.IPRanges != null && serviceProvider.IPRanges.Any((IPRange providerIPRange) => providerIPRange != null && providerIPRange.Overlaps(ipRange))))
                 {
                     task.WriteError(new SenderIPAddressOverlapsServiceProviderIPAddressesException(ipRange.Expression), ErrorCategory.InvalidArgument, null);
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        internal static List <AdFolderData> GetUserElcFolders(MailboxSession session, ADUser aduser, List <ELCFolder> allAdFolders, bool getFoldersOnly, bool getOrgFoldersOnly)
        {
            if (allAdFolders == null || allAdFolders.Count == 0 || aduser == null)
            {
                return(null);
            }
            string                arg             = session.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString();
            ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(session.MailboxOwner.MailboxInfo.OrganizationId);
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.FullyConsistent, sessionSettings, 258, "GetUserElcFolders", "f:\\15.00.1497\\sources\\dev\\infoworker\\src\\common\\ELC\\AdFolderReader.cs");
            ADObjectId            managedFolderMailboxPolicy           = aduser.ManagedFolderMailboxPolicy;

            if (managedFolderMailboxPolicy == null)
            {
                AdReader.Tracer.TraceDebug <string>(0L, "Mailbox '{0}' does not have an ELC Mailbox policy.", arg);
                return(null);
            }
            ManagedFolderMailboxPolicy managedFolderMailboxPolicy2 = tenantOrTopologyConfigurationSession.Read <ManagedFolderMailboxPolicy>(managedFolderMailboxPolicy);

            if (managedFolderMailboxPolicy2 == null)
            {
                AdReader.Tracer.TraceDebug <string, ADObjectId>(0L, "Mailbox '{0}' no matching ELC Mailbox policy for Template '{1}'.", arg, managedFolderMailboxPolicy);
                return(null);
            }
            MultiValuedProperty <ADObjectId> managedFolderLinks = managedFolderMailboxPolicy2.ManagedFolderLinks;
            List <AdFolderData> list = new List <AdFolderData>();

            using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = managedFolderLinks.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ADObjectId elcFolderId = enumerator.Current;
                    ELCFolder  elcfolder   = allAdFolders.Find((ELCFolder adFolder) => elcFolderId.ObjectGuid == adFolder.Id.ObjectGuid);
                    if (elcfolder == null)
                    {
                        throw new ELCNoMatchingOrgFoldersException(elcFolderId.DistinguishedName);
                    }
                    if (!getOrgFoldersOnly || elcfolder.FolderType == ElcFolderType.ManagedCustomFolder)
                    {
                        AdFolderData adFolderData = new AdFolderData();
                        adFolderData.LinkedToTemplate = true;
                        adFolderData.Synced           = false;
                        adFolderData.Folder           = elcfolder;
                        if (!getFoldersOnly)
                        {
                            adFolderData.FolderSettings = AdFolderReader.FetchFolderContentSettings(elcfolder);
                        }
                        list.Add(adFolderData);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 5
0
        private void InitializeUserKeywordsMapping(string keywordStatisticsQuery, MultiValuedProperty <string> userKeywords, IRecipientSession recipientSession)
        {
            if (string.IsNullOrEmpty(keywordStatisticsQuery))
            {
                return;
            }
            Util.ThrowIfNull(recipientSession, "recipientSession");
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, recipientSession.SessionSettings, 788, "InitializeUserKeywordsMapping", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\MailboxSearch\\Common\\MailboxSearchTask.cs");

            if (userKeywords != null && userKeywords.Count > 0)
            {
                CultureInfo culture = CultureInfo.InvariantCulture;
                if (this.ExportContext != null && this.ExportContext.ExportMetadata != null && !string.IsNullOrEmpty(this.ExportContext.ExportMetadata.Language))
                {
                    try
                    {
                        culture = new CultureInfo(this.ExportContext.ExportMetadata.Language);
                    }
                    catch (CultureNotFoundException)
                    {
                        ExTraceGlobals.SearchTracer.TraceError <string>((long)this.GetHashCode(), "Culture info: \"{0}\" returns CultureNotFoundException", this.ExportContext.ExportMetadata.Language);
                    }
                }
                SearchCriteria searchCriteria = new SearchCriteria(keywordStatisticsQuery, null, culture, SearchType.Statistics, recipientSession, tenantOrTopologyConfigurationSession, Guid.NewGuid(), new List <DefaultFolderType>());
                this.userKeywordsMap = new Dictionary <string, string>(userKeywords.Count);
                if (searchCriteria.SubFilters != null && searchCriteria.SubFilters.Count > 0)
                {
                    if (userKeywords.Count != searchCriteria.SubFilters.Count)
                    {
                        return;
                    }
                    int num = 0;
                    using (MultiValuedProperty <string> .Enumerator enumerator = userKeywords.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            string key   = enumerator.Current;
                            string value = searchCriteria.SubFilters.Keys.ElementAt(num++);
                            this.userKeywordsMap.Add(key, value);
                        }
                        return;
                    }
                }
                if (userKeywords.Count == 1)
                {
                    this.userKeywordsMap.Add(userKeywords[0], keywordStatisticsQuery);
                }
            }
        }
Ejemplo n.º 6
0
 internal bool GetScopedConnector()
 {
     if (this[MailGatewaySchema.IsScopedConnector] == null)
     {
         MultiValuedProperty <AddressSpace> addressSpaces = this.AddressSpaces;
         using (MultiValuedProperty <AddressSpace> .Enumerator enumerator = addressSpaces.GetEnumerator())
         {
             if (enumerator.MoveNext())
             {
                 AddressSpace addressSpace = enumerator.Current;
                 return(addressSpace.IsLocal);
             }
         }
         return(false);
     }
     return((bool)this[MailGatewaySchema.IsScopedConnector]);
 }
Ejemplo n.º 7
0
 internal static void MergeBindings(MultiValuedProperty <BindingMetadata> bindings, MultiValuedProperty <BindingMetadata> addedBindings, MultiValuedProperty <BindingMetadata> removedBindings, bool forceClear)
 {
     ArgumentValidator.ThrowIfNull("bindings", bindings);
     ArgumentValidator.ThrowIfNull("addedBindings", addedBindings);
     ArgumentValidator.ThrowIfNull("removedBindings", removedBindings);
     if (forceClear && bindings.Any <BindingMetadata>())
     {
         bindings.Clear();
         return;
     }
     using (MultiValuedProperty <BindingMetadata> .Enumerator enumerator = removedBindings.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             BindingMetadata item            = enumerator.Current;
             BindingMetadata bindingMetadata = bindings.FirstOrDefault((BindingMetadata p) => p.ImmutableIdentity == item.ImmutableIdentity);
             if (bindingMetadata != null)
             {
                 bindings.Remove(bindingMetadata);
             }
         }
     }
     using (MultiValuedProperty <BindingMetadata> .Enumerator enumerator2 = addedBindings.GetEnumerator())
     {
         while (enumerator2.MoveNext())
         {
             BindingMetadata item             = enumerator2.Current;
             BindingMetadata bindingMetadata2 = bindings.FirstOrDefault((BindingMetadata p) => p.ImmutableIdentity == item.ImmutableIdentity);
             if (bindingMetadata2 == null)
             {
                 bindings.Add(item);
             }
             else if (!string.Equals(bindingMetadata2.DisplayName, item.DisplayName, StringComparison.InvariantCulture) || !string.Equals(bindingMetadata2.Name, item.Name, StringComparison.InvariantCultureIgnoreCase))
             {
                 int index = bindings.IndexOf(bindingMetadata2);
                 bindings[index] = item;
             }
         }
     }
 }
Ejemplo n.º 8
0
        internal bool?IsDelegateOfPrincipal(Participant principal, Participant delegateParticipant)
        {
            if (this.outboundOptions == null || this.outboundOptions.RecipientCache == null)
            {
                return(null);
            }
            ProxyAddress proxyAddressForParticipant = OutboundAddressCache.GetProxyAddressForParticipant(principal);

            if (proxyAddressForParticipant == null)
            {
                return(null);
            }
            Result <ADRawEntry> result;

            if (this.outboundOptions.RecipientCache.TryGetValue(proxyAddressForParticipant, out result))
            {
                ADRawEntry data = result.Data;
                if (data == null)
                {
                    return(null);
                }
                MultiValuedProperty <ADObjectId> multiValuedProperty = data[ADRecipientSchema.GrantSendOnBehalfTo] as MultiValuedProperty <ADObjectId>;
                if (multiValuedProperty == null || multiValuedProperty.Count == 0)
                {
                    return(new bool?(false));
                }
                ProxyAddress proxyAddressForParticipant2 = OutboundAddressCache.GetProxyAddressForParticipant(delegateParticipant);
                if (proxyAddressForParticipant2 == null)
                {
                    return(null);
                }
                Result <ADRawEntry> result2;
                if (this.outboundOptions.RecipientCache.TryGetValue(proxyAddressForParticipant2, out result2))
                {
                    ADRawEntry data2 = result2.Data;
                    if (data2 == null)
                    {
                        return(null);
                    }
                    ADObjectId adobjectId = data2[ADObjectSchema.Id] as ADObjectId;
                    if (adobjectId == null)
                    {
                        goto IL_13A;
                    }
                    using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ADObjectId x = enumerator.Current;
                            if (ADObjectId.Equals(x, adobjectId))
                            {
                                return(new bool?(true));
                            }
                        }
                        goto IL_13A;
                    }
                }
                return(null);
            }
IL_13A:
            return(new bool?(false));
        }
Ejemplo n.º 9
0
        private static AuthenticationMethod ConvertAuthenticationMethods(MultiValuedProperty <AuthenticationMethod> configMethods)
        {
            AuthenticationMethod authenticationMethod = AuthenticationMethod.None;

            using (MultiValuedProperty <AuthenticationMethod> .Enumerator enumerator = configMethods.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    switch (enumerator.Current)
                    {
                    case AuthenticationMethod.Basic:
                        authenticationMethod |= AuthenticationMethod.Basic;
                        break;

                    case AuthenticationMethod.Digest:
                        authenticationMethod |= AuthenticationMethod.Digest;
                        break;

                    case AuthenticationMethod.Ntlm:
                        authenticationMethod |= AuthenticationMethod.Ntlm;
                        break;

                    case AuthenticationMethod.Fba:
                        authenticationMethod |= AuthenticationMethod.Fba;
                        break;

                    case AuthenticationMethod.WindowsIntegrated:
                        authenticationMethod |= AuthenticationMethod.WindowsIntegrated;
                        break;

                    case AuthenticationMethod.LiveIdFba:
                        authenticationMethod |= AuthenticationMethod.LiveIdFba;
                        break;

                    case AuthenticationMethod.LiveIdBasic:
                        authenticationMethod |= AuthenticationMethod.LiveIdBasic;
                        break;

                    case AuthenticationMethod.WSSecurity:
                        authenticationMethod |= AuthenticationMethod.WSSecurity;
                        break;

                    case AuthenticationMethod.Certificate:
                        authenticationMethod |= AuthenticationMethod.Certificate;
                        break;

                    case AuthenticationMethod.NegoEx:
                        authenticationMethod |= AuthenticationMethod.NegoEx;
                        break;

                    case AuthenticationMethod.OAuth:
                        authenticationMethod |= AuthenticationMethod.OAuth;
                        break;

                    case AuthenticationMethod.Adfs:
                        authenticationMethod |= AuthenticationMethod.Adfs;
                        break;

                    case AuthenticationMethod.Kerberos:
                        authenticationMethod |= AuthenticationMethod.Kerberos;
                        break;

                    case AuthenticationMethod.Negotiate:
                        authenticationMethod |= AuthenticationMethod.Negotiate;
                        break;

                    case AuthenticationMethod.LiveIdNegotiate:
                        authenticationMethod |= AuthenticationMethod.LiveIdNegotiate;
                        break;
                    }
                }
            }
            return(authenticationMethod);
        }
Ejemplo n.º 10
0
        // Token: 0x060000AF RID: 175 RVA: 0x00004C1C File Offset: 0x00002E1C
        private static AuthenticationMethod ConvertAuthenticationMethods(MultiValuedProperty <AuthenticationMethod> configMethods)
        {
            AuthenticationMethod authenticationMethod = 0;

            using (MultiValuedProperty <AuthenticationMethod> .Enumerator enumerator = configMethods.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    switch (enumerator.Current)
                    {
                    case 0:
                        authenticationMethod |= 1;
                        break;

                    case 1:
                        authenticationMethod |= 8;
                        break;

                    case 2:
                        authenticationMethod |= 2;
                        break;

                    case 3:
                        authenticationMethod |= 4;
                        break;

                    case 4:
                        authenticationMethod |= 16;
                        break;

                    case 5:
                        authenticationMethod |= 32;
                        break;

                    case 6:
                        authenticationMethod |= 64;
                        break;

                    case 7:
                        authenticationMethod |= 128;
                        break;

                    case 8:
                        authenticationMethod |= 256;
                        break;

                    case 9:
                        authenticationMethod |= 512;
                        break;

                    case 10:
                        authenticationMethod |= 1024;
                        break;

                    case 11:
                        authenticationMethod |= 2048;
                        break;

                    case 12:
                        authenticationMethod |= 4096;
                        break;

                    case 13:
                        authenticationMethod |= 8192;
                        break;

                    case 14:
                        authenticationMethod |= 16384;
                        break;
                    }
                }
            }
            return(authenticationMethod);
        }
Ejemplo n.º 11
0
        public override IEnumerable <ADObjectId> GetObjectIds(PropertyBag propertyBag)
        {
            HashSet <ADObjectId> hashSet = new HashSet <ADObjectId>();
            IDictionary <ADPropertyDefinition, object> changedProperties = ADDirSyncHelper.GetChangedProperties(this.linkProperties, propertyBag);

            foreach (KeyValuePair <ADPropertyDefinition, object> keyValuePair in changedProperties)
            {
                if (keyValuePair.Value != null)
                {
                    if (keyValuePair.Key.Type == typeof(PropertyReference))
                    {
                        MultiValuedProperty <PropertyReference> multiValuedProperty = (MultiValuedProperty <PropertyReference>)keyValuePair.Value;
                        using (MultiValuedProperty <PropertyReference> .Enumerator enumerator2 = multiValuedProperty.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                PropertyReference propertyReference = enumerator2.Current;
                                hashSet.Add(propertyReference.TargetADObjectId);
                            }
                            continue;
                        }
                    }
                    MultiValuedProperty <SyncLink> multiValuedProperty2 = (MultiValuedProperty <SyncLink>)keyValuePair.Value;
                    foreach (SyncLink syncLink in multiValuedProperty2)
                    {
                        hashSet.Add(syncLink.Link);
                    }
                }
            }
            return(hashSet);
        }
Ejemplo n.º 12
0
        internal AutoAttendantSettings GetCurrentSettings(out HolidaySchedule holidaySettings, ref bool isBusinessHour)
        {
            ExTimeZone exTimeZone = null;
            string     timeZone   = this.TimeZone;

            if (string.IsNullOrEmpty(timeZone))
            {
                ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string>((long)this.GetHashCode(), "AA [Name = \"{0}\"] TZ Id = empty string, defaulting to using Current machine timezone", base.Name);
                exTimeZone = ExTimeZone.CurrentTimeZone;
            }
            else if (!ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(this.TimeZone, out exTimeZone))
            {
                throw new InvalidOperationException(DirectoryStrings.InvalidTimeZoneId(this.TimeZone));
            }
            ExDateTime utcNow     = ExDateTime.UtcNow;
            ExDateTime exDateTime = exTimeZone.ConvertDateTime(utcNow);

            ExTraceGlobals.UMAutoAttendantTracer.TraceDebug((long)this.GetHashCode(), "AA [Name = \"{0}\"] UTC = {1} LOCAL = {2} TZ Id = {3}", new object[]
            {
                base.Name,
                utcNow.ToString("R"),
                exDateTime.ToString("R"),
                this.TimeZone
            });
            AutoAttendantSettings autoAttendantSettings            = null;
            HolidaySchedule       holidaySchedule                  = null;
            MultiValuedProperty <HolidaySchedule> holidaySchedule2 = this.HolidaySchedule;

            if (holidaySchedule2 != null && holidaySchedule2.Count > 0)
            {
                using (MultiValuedProperty <HolidaySchedule> .Enumerator enumerator = holidaySchedule2.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        HolidaySchedule holidaySchedule3 = enumerator.Current;
                        if ((ExDateTime)holidaySchedule3.StartDate.Date <= exDateTime.Date && (ExDateTime)holidaySchedule3.EndDate.Date >= exDateTime.Date)
                        {
                            ExTraceGlobals.UMAutoAttendantTracer.TraceDebug((long)this.GetHashCode(), "AA: {0} Call Time: {1} Matched with holiday: {2} {3}-{4}", new object[]
                            {
                                base.Name,
                                exDateTime.ToString("R"),
                                holidaySchedule3.Name,
                                holidaySchedule3.StartDate.ToString("R"),
                                holidaySchedule3.EndDate.ToString("R")
                            });
                            autoAttendantSettings = this.AfterHourSettings;
                            isBusinessHour        = false;
                            if (holidaySchedule == null)
                            {
                                holidaySchedule = holidaySchedule3;
                            }
                            else if (holidaySchedule3.StartDate.Date > holidaySchedule.StartDate.Date)
                            {
                                holidaySchedule = holidaySchedule3;
                            }
                            else if (holidaySchedule3.StartDate.Date == holidaySchedule.StartDate.Date)
                            {
                                int num = string.Compare(holidaySchedule.Name, holidaySchedule3.Name, StringComparison.OrdinalIgnoreCase);
                                holidaySchedule = ((num > 0) ? holidaySchedule3 : holidaySchedule);
                            }
                        }
                    }
                    goto IL_290;
                }
            }
            ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} No holiday schedule found", base.Name, exDateTime.ToString("R"));
IL_290:
            holidaySettings = holidaySchedule;
            if (autoAttendantSettings != null)
            {
                return(autoAttendantSettings);
            }
            autoAttendantSettings = this.AfterHourSettings;
            isBusinessHour        = false;
            foreach (ScheduleInterval scheduleInterval in this.BusinessHoursSchedule)
            {
                ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} BusinessHour: {2}", base.Name, exDateTime.ToString("R"), scheduleInterval.ToString());
                if (scheduleInterval.Contains(new WeekDayAndTime((DateTime)exDateTime)))
                {
                    ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} Matched with BusinessHour: {2}", base.Name, exDateTime.ToString("R"), scheduleInterval.ToString());
                    isBusinessHour        = true;
                    autoAttendantSettings = this.BusinessHourSettings;
                    break;
                }
            }
            if (!isBusinessHour)
            {
                ExTraceGlobals.UMAutoAttendantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "AA: {0} Call Time: {1} Returning AfterHour settings", base.Name, exDateTime.ToString("R"));
            }
            return(autoAttendantSettings);
        }
        private CultureInfo SelectApproverCommonCulture(ADRawEntry[] approvers)
        {
            int num = 0;
            Dictionary <int, int>    dictionary  = new Dictionary <int, int>();
            Dictionary <string, int> dictionary2 = new Dictionary <string, int>();
            int         culture     = 0;
            int         num2        = 0;
            int         culture2    = 0;
            int         num3        = 0;
            string      value       = string.Empty;
            CultureInfo cultureInfo = null;
            int         i           = 0;

            while (i < approvers.Length)
            {
                MultiValuedProperty <CultureInfo> multiValuedProperty = (MultiValuedProperty <CultureInfo>)approvers[i][ADUserSchema.Languages];
                if (multiValuedProperty.Count > 0)
                {
                    if (cultureInfo == null)
                    {
                        cultureInfo = multiValuedProperty[0];
                    }
                    List <string> list = new List <string>();
                    using (MultiValuedProperty <CultureInfo> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            CultureInfo cultureInfo2 = enumerator.Current;
                            if (dictionary.ContainsKey(cultureInfo2.LCID))
                            {
                                Dictionary <int, int> dictionary3;
                                int lcid;
                                (dictionary3 = dictionary)[lcid = cultureInfo2.LCID] = dictionary3[lcid] + 1;
                            }
                            else
                            {
                                dictionary.Add(cultureInfo2.LCID, 1);
                            }
                            if (num2 < dictionary[cultureInfo2.LCID])
                            {
                                culture = cultureInfo2.LCID;
                                num2    = dictionary[cultureInfo2.LCID];
                            }
                            if (!list.Contains(cultureInfo2.TwoLetterISOLanguageName))
                            {
                                list.Add(cultureInfo2.TwoLetterISOLanguageName);
                                if (dictionary2.ContainsKey(cultureInfo2.TwoLetterISOLanguageName))
                                {
                                    Dictionary <string, int> dictionary4;
                                    string twoLetterISOLanguageName;
                                    (dictionary4 = dictionary2)[twoLetterISOLanguageName = cultureInfo2.TwoLetterISOLanguageName] = dictionary4[twoLetterISOLanguageName] + 1;
                                }
                                else
                                {
                                    dictionary2.Add(cultureInfo2.TwoLetterISOLanguageName, 1);
                                }
                                if (num3 < dictionary2[cultureInfo2.TwoLetterISOLanguageName])
                                {
                                    num3 = dictionary2[cultureInfo2.TwoLetterISOLanguageName];
                                    if (!cultureInfo2.TwoLetterISOLanguageName.Equals(value, StringComparison.InvariantCultureIgnoreCase))
                                    {
                                        value    = cultureInfo2.TwoLetterISOLanguageName;
                                        culture2 = cultureInfo2.LCID;
                                    }
                                }
                            }
                        }
                        goto IL_19F;
                    }
                    goto IL_19B;
                }
                goto IL_19B;
                IL_19F:
                i++;
                continue;
                IL_19B:
                num++;
                goto IL_19F;
            }
            if (num == approvers.Length)
            {
                return(null);
            }
            if ((double)num2 - (double)(approvers.Length - num) / 2.0 >= 0.0)
            {
                return(new CultureInfo(culture));
            }
            if ((double)num3 - (double)(approvers.Length - num) / 2.0 >= 0.0)
            {
                return(new CultureInfo(culture2));
            }
            MultiValuedProperty <CultureInfo> multiValuedProperty2 = (MultiValuedProperty <CultureInfo>) this.requester[ADUserSchema.Languages];

            foreach (CultureInfo cultureInfo3 in multiValuedProperty2)
            {
                foreach (int num4 in dictionary.Keys)
                {
                    if (num4 == cultureInfo3.LCID)
                    {
                        return(cultureInfo3);
                    }
                }
            }
            foreach (CultureInfo cultureInfo4 in multiValuedProperty2)
            {
                foreach (string value2 in dictionary2.Keys)
                {
                    if (cultureInfo4.TwoLetterISOLanguageName.Equals(value2, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(cultureInfo4);
                    }
                }
            }
            return(cultureInfo);
        }
Ejemplo n.º 14
0
        private static ICollection ConvertValue(object value, ArrayList newValues)
        {
            if (newValues == null)
            {
                newValues = new ArrayList();
            }
            ApprovedApplication approvedApplication = (ApprovedApplication)ValueConvertor.ConvertValue(value, typeof(ApprovedApplication), null);

            if (approvedApplication != null)
            {
                if (approvedApplication.IsCab)
                {
                    MultiValuedProperty <ApprovedApplication> multiValuedProperty = ApprovedApplication.ParseCab(approvedApplication.CabName);
                    using (MultiValuedProperty <ApprovedApplication> .Enumerator enumerator = multiValuedProperty.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            ApprovedApplication value2 = enumerator.Current;
                            newValues.Add(value2);
                        }
                        return(newValues);
                    }
                }
                newValues.Add(value);
                return(newValues);
            }
            throw new DataValidationException(new PropertyValidationError(DirectoryStrings.ExceptionInvalidApprovedApplication(value.ToString()), MobileMailboxPolicySchema.ADApprovedApplicationList, value));
        }
Ejemplo n.º 15
0
 internal static void ValidateAssociatedAcceptedDomains(MultiValuedProperty <AcceptedDomainIdParameter> domainIdParameters, IConfigDataProvider dataSession, TenantInboundConnector dataObject, ObjectId rootId, Task task, Func <IIdentityParameter, IConfigDataProvider, ObjectId, LocalizedString?, LocalizedString?, IConfigurable> acceptedDomainsGetter)
 {
     if (domainIdParameters != null)
     {
         NewInboundConnector.ValidateCentralizedMailControlAndAssociatedAcceptedDomainsRestriction(dataSession, dataObject, task);
         dataObject.AssociatedAcceptedDomains.Clear();
         using (MultiValuedProperty <AcceptedDomainIdParameter> .Enumerator enumerator = domainIdParameters.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 AcceptedDomainIdParameter acceptedDomainIdParameter = enumerator.Current;
                 AcceptedDomain            acceptedDomain            = (AcceptedDomain)acceptedDomainsGetter(acceptedDomainIdParameter, dataSession, rootId, new LocalizedString?(Strings.ErrorDefaultDomainNotFound(acceptedDomainIdParameter)), new LocalizedString?(Strings.ErrorDefaultDomainNotUnique(acceptedDomainIdParameter)));
                 dataObject.AssociatedAcceptedDomains.Add(acceptedDomain.Id);
             }
             return;
         }
     }
     dataObject.AssociatedAcceptedDomains.Clear();
 }