コード例 #1
0
        private IEnumerable <BindingStorage> FindBindingStorage(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize = 2147483647, bool includeScopes = true)
        {
            IEnumerable <BindingStorage> configurables = base.FindAndHandleException <BindingStorage>(filter, rootId, deepSearch, sortBy, pageSize);

            if (configurables == null || configurables.Count <BindingStorage>() == 0)
            {
                configurables = base.GetDefaultArray <BindingStorage>();
            }
            configurables = this.DoPostQueryFilter <BindingStorage>(filter, configurables);
            foreach (BindingStorage configurable in configurables)
            {
                FfoDirectorySession.FixDistinguishedName(configurable, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)configurable.Identity).ObjectGuid, null);
                IEnumerable <ScopeStorage> childScopes = base.FindAndHandleException <ScopeStorage>(QueryFilter.AndTogether(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.OrganizationalUnitRoot, base.TenantId),
                    new ComparisonFilter(ComparisonOperator.Equal, DalHelper.ContainerProp, configurable.Id.ObjectGuid)
                }), rootId, deepSearch, sortBy, pageSize);
                foreach (ScopeStorage scopeStorage in childScopes)
                {
                    scopeStorage.ResetChangeTracking();
                }
                configurable.AppliedScopes = new MultiValuedProperty <ScopeStorage>(childScopes);
                yield return(configurable);
            }
            yield break;
        }
コード例 #2
0
        private IEnumerable <TransportRuleCollection> FindTransportRuleCollections(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize = 2147483647)
        {
            object obj;
            Guid   objectGuid;
            IEnumerable <TransportRuleCollection> enumerable;

            if (DalHelper.TryFindPropertyValueByName(filter, ADObjectSchema.Name.Name, out obj) && obj is string && FfoConfigurationSession.builtInTransportRuleContainers.TryGetValue((string)obj, out objectGuid))
            {
                TransportRuleCollection transportRuleCollection = new TransportRuleCollection
                {
                    Name = (string)obj
                };
                FfoDirectorySession.FixDistinguishedName(transportRuleCollection, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, objectGuid, null);
                enumerable = new TransportRuleCollection[]
                {
                    transportRuleCollection
                };
            }
            else
            {
                enumerable = base.FindAndHandleException <TransportRuleCollection>(filter, rootId, deepSearch, sortBy, pageSize);
                foreach (TransportRuleCollection transportRuleCollection2 in enumerable)
                {
                    FfoDirectorySession.FixDistinguishedName(transportRuleCollection2, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)transportRuleCollection2.Identity).ObjectGuid, null);
                }
            }
            return(enumerable);
        }
コード例 #3
0
        private IEnumerable <ExchangeRoleAssignment> FindExchangeRoleAssignments(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize = 2147483647, bool includeScopes = true)
        {
            IEnumerable <ExchangeRoleAssignment> roleAssignments = base.FindAndHandleException <ExchangeRoleAssignment>(filter, rootId, deepSearch, sortBy, pageSize);
            IEnumerable <string> roleNames = (from roleAssignment in roleAssignments
                                              select roleAssignment.Role.Name).Distinct(StringComparer.OrdinalIgnoreCase).ToArray <string>();
            Dictionary <string, ExchangeRole> cannedRoles = new Dictionary <string, ExchangeRole>(StringComparer.OrdinalIgnoreCase);

            foreach (string text in roleNames)
            {
                ExchangeRole exchangeRole = new ExchangeRole
                {
                    Name = text
                };
                if (this.UpdateImplictScope(exchangeRole))
                {
                    cannedRoles.Add(text, exchangeRole);
                }
            }
            foreach (ExchangeRoleAssignment roleAssignment2 in roleAssignments)
            {
                FfoDirectorySession.FixDistinguishedName(roleAssignment2, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)roleAssignment2.Identity).ObjectGuid, ExchangeRoleAssignment.RdnContainer);
                roleAssignment2.Role = FfoDirectorySession.GetUpdatedADObjectIdWithDN(roleAssignment2.Role, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ExchangeRole.RdnContainer);
                if (roleAssignment2.RoleAssigneeType == RoleAssigneeType.RoleGroup && cannedRoles.ContainsKey(roleAssignment2.Role.Name))
                {
                    ExchangeRole exchangeRole2 = cannedRoles[roleAssignment2.Role.Name];
                    roleAssignment2.RecipientReadScope  = exchangeRole2.ImplicitRecipientReadScope;
                    roleAssignment2.ConfigReadScope     = exchangeRole2.ImplicitConfigReadScope;
                    roleAssignment2.RecipientWriteScope = (RecipientWriteScopeType)exchangeRole2.ImplicitRecipientWriteScope;
                    roleAssignment2.ConfigWriteScope    = (ConfigWriteScopeType)exchangeRole2.ImplicitConfigWriteScope;
                }
                yield return(roleAssignment2);
            }
            yield break;
        }
コード例 #4
0
        private IConfigurable ReadImpl <T>(ObjectId id) where T : IConfigurable, new()
        {
            if (typeof(T) == typeof(ExchangeConfigurationUnit))
            {
                FfoTenant ffoTenant = base.ReadAndHandleException <FfoTenant>(base.AddTenantIdFilter(null));
                return(FfoConfigurationSession.GetExchangeConfigurationUnit(ffoTenant));
            }
            if (typeof(T) == typeof(ADOrganizationalUnit))
            {
                FfoTenant ffoTenant2 = base.ReadAndHandleException <FfoTenant>(base.AddTenantIdFilter(null));
                return(FfoConfigurationSession.GetADOrganizationalUnit(ffoTenant2));
            }
            if (typeof(T) == typeof(Organization))
            {
                FfoTenant ffoTenant3 = base.ReadAndHandleException <FfoTenant>(base.AddTenantIdFilter(null));
                return(FfoConfigurationSession.GetOrganization(ffoTenant3));
            }
            T        t        = base.ReadAndHandleException <T>(base.AddTenantIdFilter(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, id)));
            ADObject adobject = t as ADObject;

            if (adobject != null)
            {
                FfoDirectorySession.FixDistinguishedName(adobject, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)adobject.Identity).ObjectGuid, null);
            }
            return(t);
        }
コード例 #5
0
 private static void SetTenantIds(FfoTenant ffoTenant, ADObject adTenantObject)
 {
     if (ffoTenant == null)
     {
         return;
     }
     adTenantObject.Name = ffoTenant.TenantName;
     FfoDirectorySession.FixDistinguishedName(adTenantObject, DalHelper.GetTenantDistinguishedName(ffoTenant.TenantName), ffoTenant.TenantId.ObjectGuid, ffoTenant.TenantId.ObjectGuid, null);
 }
コード例 #6
0
        private IConfigurable GetExtendedSecurityPrincipal(ADUser user)
        {
            if (user == null)
            {
                return(null);
            }
            FfoDirectorySession.FixDistinguishedName(user, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)user.Identity).ObjectGuid, null);
            ExtendedSecurityPrincipal extendedSecurityPrincipal = new ExtendedSecurityPrincipal();

            DalHelper.SetConfigurableObject(user.DisplayName, ExtendedSecurityPrincipalSchema.DisplayName, extendedSecurityPrincipal);
            DalHelper.SetConfigurableObject(user.DisplayName, ADObjectSchema.RawName, extendedSecurityPrincipal);
            DalHelper.SetConfigurableObject(new SecurityIdentifier(WellKnownSidType.NullSid, null), IADSecurityPrincipalSchema.Sid, extendedSecurityPrincipal);
            DalHelper.SetConfigurableObject(user.Id.GetChildId(ADUser.ObjectCategoryNameInternal), ADObjectSchema.ObjectCategory, extendedSecurityPrincipal);
            DalHelper.SetConfigurableObject(user.ObjectClass, ADObjectSchema.ObjectClass, extendedSecurityPrincipal);
            DalHelper.SetConfigurableObject(RecipientTypeDetails.MailUser, ExtendedSecurityPrincipalSchema.RecipientTypeDetails, extendedSecurityPrincipal);
            extendedSecurityPrincipal.SetId(user.Id);
            return(extendedSecurityPrincipal);
        }
コード例 #7
0
        private IConfigurable ReadImpl <T>(ObjectId identity) where T : IConfigurable, new()
        {
            QueryFilter filter = base.AddTenantIdFilter(new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, identity));

            if (typeof(T) == typeof(ExtendedSecurityPrincipal))
            {
                ADUser user = base.ReadAndHandleException <ADUser>(filter);
                return((T)((object)this.GetExtendedSecurityPrincipal(user)));
            }
            T        t        = base.ReadAndHandleException <T>(filter);
            ADObject adobject = t as ADObject;

            if (adobject != null)
            {
                FfoDirectorySession.FixDistinguishedName(adobject, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)adobject.Identity).ObjectGuid, null);
                return((T)((object)this.FixRecipientProperties(adobject)));
            }
            return(t);
        }
コード例 #8
0
        protected IConfigurable[] FindTenantObject <T>(params object[] propNameValues) where T : IConfigurable, new()
        {
            QueryFilter[] array = new QueryFilter[propNameValues.Length / 2];
            for (int i = 0; i < propNameValues.Length; i += 2)
            {
                array[i / 2] = new ComparisonFilter(ComparisonOperator.Equal, (PropertyDefinition)propNameValues[i], propNameValues[i + 1]);
            }
            QueryFilter filter = QueryFilter.AndTogether(array);

            IConfigurable[] array2 = this.FindAndHandleException <T>(filter, null, false, null, int.MaxValue).Cast <IConfigurable>().ToArray <IConfigurable>();
            IConfigurable[] array3 = array2;
            for (int j = 0; j < array3.Length; j++)
            {
                T        t        = (T)((object)array3[j]);
                ADObject adobject = t as ADObject;
                if (adobject != null)
                {
                    FfoDirectorySession.FixDistinguishedName(adobject, this.TenantId.DistinguishedName, this.TenantId.ObjectGuid, ((ADObjectId)adobject.Identity).ObjectGuid, null);
                }
            }
            return(array2);
        }
コード例 #9
0
        private static IEnumerable <TenantInboundConnector> GetInboundConnectors(IConfigDataProvider dataProvider, ADPropertyDefinition propertyDefinition, IEnumerable <string> propertyValues, bool enabledOnly)
        {
            IEnumerable <ComparisonFilter> propertyNameFilters = from propertyValue in propertyValues
                                                                 select new ComparisonFilter(ComparisonOperator.Equal, propertyDefinition, propertyValue);
            QueryFilter filter = QueryFilter.AndTogether(new QueryFilter[]
            {
                QueryFilter.OrTogether(propertyNameFilters.ToArray <QueryFilter>()),
                new ComparisonFilter(ComparisonOperator.Equal, DalHelper.CacheFailoverModeProp, CacheFailoverMode.BloomFilter)
            });
            IEnumerable <IConfigurable> inboundConnectors = dataProvider.Find <TenantInboundConnector>(filter, null, false, null);

            foreach (IConfigurable configurable in inboundConnectors)
            {
                TenantInboundConnector inboundConnector = (TenantInboundConnector)configurable;
                if (!enabledOnly || inboundConnector.Enabled)
                {
                    FfoDirectorySession.FixDistinguishedName(inboundConnector, DalHelper.GetTenantDistinguishedName(inboundConnector.OrganizationalUnitRoot.ObjectGuid.ToString()), inboundConnector.OrganizationalUnitRoot.ObjectGuid, inboundConnector.Id.ObjectGuid, null);
                    yield return(inboundConnector);
                }
            }
            yield break;
        }
コード例 #10
0
 private IEnumerable <T> FindImpl <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) where T : IConfigurable, new()
 {
     if (base.TenantId == null)
     {
         FfoDirectorySession.LogNotSupportedInFFO(null);
     }
     else
     {
         filter = this.AddFilterOperator(filter);
         if (typeof(T) == typeof(ExtendedSecurityPrincipal))
         {
             filter = FfoRecipientSession.ReduceSecurityPrincipalFilter(filter);
             IEnumerable <ADUser> users = base.FindAndHandleException <ADUser>(filter, rootId, deepSearch, sortBy, pageSize);
             foreach (ADUser user in users)
             {
                 yield return((T)((object)this.GetExtendedSecurityPrincipal(user)));
             }
         }
         else
         {
             IEnumerable <T> configObjs = base.FindAndHandleException <T>(base.AddTenantIdFilter(filter), rootId, deepSearch, sortBy, pageSize);
             foreach (T configObj in configObjs)
             {
                 ADObject adObject = configObj as ADObject;
                 if (adObject != null)
                 {
                     FfoDirectorySession.FixDistinguishedName(adObject, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)adObject.Identity).ObjectGuid, null);
                     yield return((T)((object)this.FixRecipientProperties(adObject)));
                 }
                 else
                 {
                     yield return(configObj);
                 }
             }
         }
     }
     yield break;
 }
コード例 #11
0
 private IEnumerable <T> FindImpl <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) where T : IConfigurable, new()
 {
     if (base.TenantId == null)
     {
         FfoDirectorySession.LogNotSupportedInFFO(null);
     }
     else if (typeof(T) == typeof(ExchangeConfigurationUnit))
     {
         IEnumerable <FfoTenant> ffoTenants = base.FindAndHandleException <FfoTenant>(filter, rootId, deepSearch, sortBy, pageSize);
         foreach (FfoTenant ffoTenant in ffoTenants)
         {
             yield return((T)((object)FfoConfigurationSession.GetExchangeConfigurationUnit(ffoTenant)));
         }
     }
     else if (typeof(T) == typeof(ADOrganizationalUnit))
     {
         IEnumerable <FfoTenant> ffoTenants2 = base.FindAndHandleException <FfoTenant>(filter, rootId, deepSearch, sortBy, pageSize);
         foreach (FfoTenant ffoTenant2 in ffoTenants2)
         {
             yield return((T)((object)FfoConfigurationSession.GetADOrganizationalUnit(ffoTenant2)));
         }
     }
     else if (typeof(T) == typeof(Organization))
     {
         IEnumerable <FfoTenant> ffoTenants3 = base.FindAndHandleException <FfoTenant>(filter, rootId, deepSearch, sortBy, pageSize);
         foreach (FfoTenant ffoTenant3 in ffoTenants3)
         {
             yield return((T)((object)FfoConfigurationSession.GetOrganization(ffoTenant3)));
         }
     }
     else if (typeof(T) == typeof(TransportRuleCollection))
     {
         IEnumerable <TransportRuleCollection> collections = this.FindTransportRuleCollections(filter, rootId, deepSearch, sortBy, pageSize);
         foreach (TransportRuleCollection coll in collections)
         {
             yield return((T)((object)coll));
         }
     }
     else if (typeof(T) == typeof(BindingStorage))
     {
         IEnumerable <BindingStorage> bindings = this.FindBindingStorage(filter, rootId, deepSearch, sortBy, pageSize, true);
         foreach (BindingStorage storage in bindings)
         {
             yield return((T)((object)storage));
         }
     }
     else if (typeof(T) == typeof(ExchangeRoleAssignment))
     {
         IEnumerable <ExchangeRoleAssignment> roleAssignments = this.FindExchangeRoleAssignments(filter, rootId, deepSearch, sortBy, pageSize, true);
         foreach (ExchangeRoleAssignment roleAssignment in roleAssignments)
         {
             yield return((T)((object)roleAssignment));
         }
     }
     else if (typeof(T) == typeof(ExchangeRole))
     {
         IEnumerable <ExchangeRole> exchangeRoles = base.FindAndHandleException <ExchangeRole>(filter, rootId, deepSearch, sortBy, pageSize);
         foreach (ExchangeRole exchangeRole in exchangeRoles)
         {
             FfoDirectorySession.FixDistinguishedName(exchangeRole, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)exchangeRole.Identity).ObjectGuid, ExchangeRole.RdnContainer);
             this.UpdateImplictScope(exchangeRole);
             yield return((T)((object)exchangeRole));
         }
     }
     else
     {
         IEnumerable <T> configurables = null;
         try
         {
             configurables = base.FindAndHandleException <T>(filter, rootId, deepSearch, sortBy, pageSize);
         }
         catch (DataProviderMappingException ex)
         {
             FfoDirectorySession.LogNotSupportedInFFO(ex);
         }
         if (configurables == null || configurables.Count <T>() == 0)
         {
             configurables = base.GetDefaultArray <T>();
         }
         configurables = this.DoPostQueryFilter <T>(filter, configurables);
         foreach (T configurable in configurables)
         {
             ADObject adObject = configurable as ADObject;
             if (adObject != null)
             {
                 FfoDirectorySession.FixDistinguishedName(adObject, base.TenantId.DistinguishedName, base.TenantId.ObjectGuid, ((ADObjectId)adObject.Identity).ObjectGuid, null);
             }
             yield return(configurable);
         }
     }
     yield break;
 }