Exemple #1
0
 internal static void CheckIfObjectsRefersToSingleDirectoryServer(ADSessionInfo sessionInfo, ICollection <ADObject> objectList, bool checkForDCs, out string referredDirectoryServerDN, out ADObject computerObj, out ADObject serverObj, out ADObject ntdsDSAObj)
 {
     referredDirectoryServerDN = null;
     computerObj = null;
     serverObj   = null;
     ntdsDSAObj  = null;
     foreach (ADObject aDObject in objectList)
     {
         bool?nullable = aDObject.IsOfType("server");
         if (!nullable.Value)
         {
             bool?nullable1 = aDObject.IsOfType("computer");
             if (!nullable1.Value)
             {
                 bool?nullable2 = aDObject.IsOfType("nTDSDSA");
                 if (!nullable2.Value)
                 {
                     object[] objectClass = new object[1];
                     objectClass[0] = aDObject.ObjectClass;
                     DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Unknown object of type: '{0}' found in directory server list", objectClass));
                     throw new NotSupportedException(string.Format(StringResources.UnsupportedObjectClass, aDObject.ObjectClass));
                 }
                 else
                 {
                     if (ntdsDSAObj != null)
                     {
                         object[] objArray = new object[1];
                         objArray[0] = "nTDSDSA";
                         DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Duplicate object of type: '{0}' found in directory server list", objArray));
                         throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
                     }
                     else
                     {
                         ntdsDSAObj = aDObject;
                     }
                 }
             }
             else
             {
                 if (checkForDCs)
                 {
                     if (computerObj != null)
                     {
                         object[] objArray1 = new object[1];
                         objArray1[0] = "computer";
                         DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Duplicate object of type: '{0}' found in directory server list", objArray1));
                         throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
                     }
                     else
                     {
                         computerObj = aDObject;
                     }
                 }
                 else
                 {
                     object[] objectClass1 = new object[1];
                     objectClass1[0] = aDObject.ObjectClass;
                     DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Unknown object of type: '{0}' found in directory server list", objectClass1));
                     throw new NotSupportedException(string.Format(StringResources.UnsupportedObjectClass, aDObject.ObjectClass));
                 }
             }
         }
         else
         {
             if (serverObj != null)
             {
                 if (!DirectoryServerUtil.IsStaleServerObject(sessionInfo, aDObject.DistinguishedName))
                 {
                     object[] objArray2 = new object[1];
                     objArray2[0] = "server";
                     DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Duplicate object of type: '{0}' found in directory server list", objArray2));
                     throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
                 }
                 else
                 {
                     object[] distinguishedName = new object[1];
                     distinguishedName[0] = aDObject.DistinguishedName;
                     DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Stale server object : '{0}' found in directory server list", distinguishedName));
                 }
             }
             else
             {
                 if (DirectoryServerUtil.IsStaleServerObject(sessionInfo, aDObject.DistinguishedName))
                 {
                     object[] distinguishedName1 = new object[1];
                     distinguishedName1[0] = aDObject.DistinguishedName;
                     DebugLogger.LogInfo("DirectoryServerUtil", string.Format(CultureInfo.CurrentCulture, "Stale server object : '{0}' found in directory server list", distinguishedName1));
                 }
                 else
                 {
                     serverObj = aDObject;
                 }
             }
         }
     }
     if (computerObj != null)
     {
         referredDirectoryServerDN = computerObj["serverReferenceBL"].Value as string;
     }
     if (serverObj != null)
     {
         if (referredDirectoryServerDN == null || referredDirectoryServerDN.Equals(serverObj.DistinguishedName, StringComparison.OrdinalIgnoreCase))
         {
             referredDirectoryServerDN = serverObj.DistinguishedName;
         }
         else
         {
             throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
         }
     }
     if (ntdsDSAObj != null)
     {
         string str = ntdsDSAObj.DistinguishedName.Substring("CN=NTDS Settings,".Length);
         if (referredDirectoryServerDN == null || referredDirectoryServerDN.Equals(str, StringComparison.OrdinalIgnoreCase))
         {
             referredDirectoryServerDN = str;
         }
         else
         {
             throw new ADMultipleMatchingIdentitiesException(StringResources.MultipleMatches);
         }
     }
 }
Exemple #2
0
        private static Dictionary <RecipientTypeDetails, QueryFilter> InitializeStaticRecipientTypeDetailsFilterOptimizations()
        {
            Dictionary <RecipientTypeDetails, QueryFilter> dictionary = new Dictionary <RecipientTypeDetails, QueryFilter>(32);
            RecipientTypeDetails key = RecipientTypeDetails.UserMailbox | RecipientTypeDetails.LinkedMailbox | RecipientTypeDetails.SharedMailbox | RecipientTypeDetails.LegacyMailbox | RecipientTypeDetails.RoomMailbox | RecipientTypeDetails.EquipmentMailbox | RecipientTypeDetails.MailContact | RecipientTypeDetails.MailUser | RecipientTypeDetails.MailUniversalDistributionGroup | RecipientTypeDetails.MailUniversalSecurityGroup | RecipientTypeDetails.DynamicDistributionGroup | RecipientTypeDetails.MailForestContact | RecipientTypeDetails.RoomList | RecipientTypeDetails.DiscoveryMailbox | RecipientTypeDetails.RemoteUserMailbox | RecipientTypeDetails.RemoteRoomMailbox | RecipientTypeDetails.RemoteEquipmentMailbox | RecipientTypeDetails.RemoteSharedMailbox | RecipientTypeDetails.TeamMailbox | RecipientTypeDetails.RemoteTeamMailbox | RecipientTypeDetails.GroupMailbox | RecipientTypeDetails.LinkedRoomMailbox | RecipientTypeDetails.RemoteGroupMailbox;

            dictionary.Add(key, new AndFilter(new QueryFilter[]
            {
                Filters.AllMailableUsersContactsDDLsUniversalGroupsFilter,
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.ArbitrationMailbox)),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.AuditLogMailbox)),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailboxPlan))
            }));
            dictionary.Add(RecipientTypeDetails.User | RecipientTypeDetails.DisabledUser, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.User),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.LinkedUser))
            }));
            dictionary.Add(RecipientTypeDetails.UniversalDistributionGroup | RecipientTypeDetails.UniversalSecurityGroup, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.Group),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RoleGroup)),
                Filters.CreateUniversalGroupFilter(true)
            }));
            dictionary.Add(RecipientTypeDetails.MailContact | RecipientTypeDetails.MailForestContact, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailContact)
            }));
            key = (RecipientTypeDetails.UserMailbox | RecipientTypeDetails.LinkedMailbox | RecipientTypeDetails.SharedMailbox | RecipientTypeDetails.LegacyMailbox | RecipientTypeDetails.RoomMailbox | RecipientTypeDetails.EquipmentMailbox | RecipientTypeDetails.MailUser | RecipientTypeDetails.User | RecipientTypeDetails.DisabledUser | RecipientTypeDetails.RemoteUserMailbox | RecipientTypeDetails.RemoteRoomMailbox | RecipientTypeDetails.RemoteEquipmentMailbox | RecipientTypeDetails.RemoteSharedMailbox | RecipientTypeDetails.TeamMailbox | RecipientTypeDetails.RemoteTeamMailbox);
            dictionary.Add(key, new OrFilter(new QueryFilter[]
            {
                new AndFilter(new QueryFilter[]
                {
                    ADUser.ImplicitFilterInternal,
                    new NotFilter(new ExistsFilter(ADRecipientSchema.RecipientTypeDetailsValue))
                }),
                new AndFilter(new QueryFilter[]
                {
                    ADUser.ImplicitFilterInternal,
                    new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.DiscoveryMailbox)),
                    new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.LinkedUser))
                })
            }));
            key = (RecipientTypeDetails.UserMailbox | RecipientTypeDetails.LinkedMailbox | RecipientTypeDetails.SharedMailbox | RecipientTypeDetails.LegacyMailbox | RecipientTypeDetails.RoomMailbox | RecipientTypeDetails.EquipmentMailbox | RecipientTypeDetails.MailContact | RecipientTypeDetails.MailUser | RecipientTypeDetails.MailUniversalDistributionGroup | RecipientTypeDetails.MailNonUniversalGroup | RecipientTypeDetails.MailUniversalSecurityGroup | RecipientTypeDetails.DynamicDistributionGroup | RecipientTypeDetails.PublicFolder | RecipientTypeDetails.MailForestContact | RecipientTypeDetails.RoomList | RecipientTypeDetails.DiscoveryMailbox | RecipientTypeDetails.RemoteUserMailbox | RecipientTypeDetails.RemoteRoomMailbox | RecipientTypeDetails.RemoteEquipmentMailbox | RecipientTypeDetails.RemoteSharedMailbox | RecipientTypeDetails.TeamMailbox | RecipientTypeDetails.RemoteTeamMailbox | RecipientTypeDetails.LinkedRoomMailbox);
            dictionary.Add(key, Filters.AllRecipientsForGetRecipientTask);
            key = (RecipientTypeDetails.UserMailbox | RecipientTypeDetails.LinkedMailbox | RecipientTypeDetails.SharedMailbox | RecipientTypeDetails.LegacyMailbox | RecipientTypeDetails.RoomMailbox | RecipientTypeDetails.EquipmentMailbox | RecipientTypeDetails.DiscoveryMailbox | RecipientTypeDetails.TeamMailbox | RecipientTypeDetails.GroupMailbox | RecipientTypeDetails.LinkedRoomMailbox);
            dictionary.Add(key, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.ArbitrationMailbox)),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.AuditLogMailbox)),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailboxPlan))
            }));
            key = (RecipientTypeDetails.MailUniversalDistributionGroup | RecipientTypeDetails.MailNonUniversalGroup | RecipientTypeDetails.MailUniversalSecurityGroup | RecipientTypeDetails.RoomList);
            dictionary.Add(key, new OrFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailNonUniversalGroup),
                Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalDistributionGroup),
                Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalSecurityGroup)
            }));
            key = (RecipientTypeDetails.MailUniversalDistributionGroup | RecipientTypeDetails.MailNonUniversalGroup | RecipientTypeDetails.MailUniversalSecurityGroup);
            dictionary.Add(key, new AndFilter(new QueryFilter[]
            {
                new OrFilter(new QueryFilter[]
                {
                    Filters.CreateRecipientTypeFilter(RecipientType.MailNonUniversalGroup),
                    Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalDistributionGroup),
                    Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalSecurityGroup)
                }),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RoomList))
            }));
            dictionary.Add(RecipientTypeDetails.RoomMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RoomMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.LinkedRoomMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.LinkedRoomMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.EquipmentMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.EquipmentMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.LinkedMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.LinkedMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.UserMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.UserMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.MailForestContact, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailContact),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailForestContact)
            }));
            dictionary.Add(RecipientTypeDetails.SharedMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.SharedMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.TeamMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.TeamMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.RemoteGroupMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalDistributionGroup),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RemoteGroupMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.GroupMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.GroupMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.ArbitrationMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.ArbitrationMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.MailboxPlan, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailboxPlan)
            }));
            dictionary.Add(RecipientTypeDetails.LinkedUser, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.User),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.LinkedUser)
            }));
            dictionary.Add(RecipientTypeDetails.RoomList, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalDistributionGroup),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RoomList)
            }));
            dictionary.Add(RecipientTypeDetails.DiscoveryMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.DiscoveryMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.AuditLogMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.AuditLogMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.LegacyMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.UserMailbox),
                new OrFilter(new QueryFilter[]
                {
                    new NotFilter(new ExistsFilter(ADRecipientSchema.RecipientTypeDetailsValue)),
                    Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.LegacyMailbox)
                })
            }));
            dictionary.Add(RecipientTypeDetails.MailContact, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailContact),
                new OrFilter(new QueryFilter[]
                {
                    new NotFilter(new ExistsFilter(ADRecipientSchema.RecipientTypeDetailsValue)),
                    Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailContact)
                })
            }));
            dictionary.Add(RecipientTypeDetails.User, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.User),
                Filters.UserEnabledFilter
            }));
            dictionary.Add(RecipientTypeDetails.Contact, Filters.CreateRecipientTypeFilter(RecipientType.Contact));
            dictionary.Add(RecipientTypeDetails.UniversalDistributionGroup, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.Group),
                Filters.UniversalDistributionGroupFilter
            }));
            dictionary.Add(RecipientTypeDetails.UniversalSecurityGroup, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.Group),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RoleGroup)),
                Filters.UniversalSecurityGroupFilter
            }));
            dictionary.Add(RecipientTypeDetails.RoleGroup, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.Group),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RoleGroup),
                Filters.UniversalSecurityGroupFilter
            }));
            dictionary.Add(RecipientTypeDetails.NonUniversalGroup, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.Group),
                Filters.NonUniversalGroupFilter
            }));
            dictionary.Add(RecipientTypeDetails.DisabledUser, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.User),
                Filters.UserDisabledFilter,
                new OrFilter(new QueryFilter[]
                {
                    new NotFilter(new ExistsFilter(ADRecipientSchema.RecipientTypeDetailsValue)),
                    Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.DisabledUser)
                })
            }));
            key = (RecipientTypeDetails.UserMailbox | RecipientTypeDetails.LinkedMailbox | RecipientTypeDetails.SharedMailbox | RecipientTypeDetails.LegacyMailbox | RecipientTypeDetails.RoomMailbox | RecipientTypeDetails.EquipmentMailbox | RecipientTypeDetails.MailContact | RecipientTypeDetails.MailUser | RecipientTypeDetails.MailForestContact | RecipientTypeDetails.DiscoveryMailbox | RecipientTypeDetails.RemoteUserMailbox | RecipientTypeDetails.RemoteRoomMailbox | RecipientTypeDetails.RemoteEquipmentMailbox | RecipientTypeDetails.RemoteSharedMailbox | RecipientTypeDetails.TeamMailbox | RecipientTypeDetails.RemoteTeamMailbox | RecipientTypeDetails.GroupMailbox | RecipientTypeDetails.LinkedRoomMailbox | RecipientTypeDetails.RemoteGroupMailbox);
            dictionary.Add(key, new AndFilter(new QueryFilter[]
            {
                Filters.CreateMailEnabledFilter(true),
                ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.ArbitrationMailbox)),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.AuditLogMailbox)),
                new NotFilter(Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailboxPlan))
            }));
            dictionary.Add(RecipientTypeDetails.MailUser, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUser),
                new OrFilter(new QueryFilter[]
                {
                    Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailUser),
                    new NotFilter(new ExistsFilter(ADRecipientSchema.RecipientTypeDetailsValue))
                })
            }));
            dictionary.Add(RecipientTypeDetails.MailUniversalDistributionGroup, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalDistributionGroup),
                new OrFilter(new QueryFilter[]
                {
                    new NotFilter(new ExistsFilter(ADRecipientSchema.RecipientTypeDetailsValue)),
                    Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MailUniversalDistributionGroup)
                })
            }));
            dictionary.Add(RecipientTypeDetails.MailUniversalSecurityGroup, Filters.CreateRecipientTypeFilter(RecipientType.MailUniversalSecurityGroup));
            dictionary.Add(RecipientTypeDetails.MailNonUniversalGroup, Filters.CreateRecipientTypeFilter(RecipientType.MailNonUniversalGroup));
            dictionary.Add(RecipientTypeDetails.DynamicDistributionGroup, Filters.CreateRecipientTypeFilter(RecipientType.DynamicDistributionGroup));
            dictionary.Add(RecipientTypeDetails.PublicFolder, Filters.CreateRecipientTypeFilter(RecipientType.PublicFolder));
            dictionary.Add(RecipientTypeDetails.MicrosoftExchange, Filters.CreateRecipientTypeFilter(RecipientType.MicrosoftExchange));
            dictionary.Add(RecipientTypeDetails.SystemAttendantMailbox, Filters.CreateRecipientTypeFilter(RecipientType.SystemAttendantMailbox));
            dictionary.Add(RecipientTypeDetails.SystemMailbox, Filters.CreateRecipientTypeFilter(RecipientType.SystemMailbox));
            dictionary.Add((RecipientTypeDetails)((ulong)int.MinValue), new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUser),
                Filters.CreateRecipientTypeDetailsValueFilter((RecipientTypeDetails)((ulong)int.MinValue))
            }));
            dictionary.Add(RecipientTypeDetails.Computer, Filters.CreateRecipientTypeFilter(RecipientType.Computer));
            dictionary.Add(RecipientTypeDetails.RemoteRoomMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUser),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RemoteRoomMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.RemoteEquipmentMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUser),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RemoteEquipmentMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.RemoteTeamMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUser),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RemoteTeamMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.RemoteSharedMailbox, new AndFilter(new QueryFilter[]
            {
                Filters.CreateRecipientTypeFilter(RecipientType.MailUser),
                Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.RemoteSharedMailbox)
            }));
            dictionary.Add(RecipientTypeDetails.PublicFolderMailbox, Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.PublicFolderMailbox));
            dictionary.Add(RecipientTypeDetails.MonitoringMailbox, Filters.CreateRecipientTypeDetailsValueFilter(RecipientTypeDetails.MonitoringMailbox));
            return(dictionary);
        }
Exemple #3
0
 // Token: 0x06001611 RID: 5649 RVA: 0x00052A90 File Offset: 0x00050C90
 public static CmdletProxyInfo.ChangeCmdletProxyParametersDelegate AppendIdentityToProxyCmdlet(ADObject adObject)
 {
     return(delegate(PropertyBag parameters)
     {
         if (adObject != null && adObject.Id != null)
         {
             if (parameters.Contains("Identity"))
             {
                 parameters.Remove("Identity");
             }
             parameters.Add("Identity", adObject.Id.DistinguishedName);
         }
     });
 }
        private static QueryFilter GenerateTargetFilterForUserAndNonDomainLocalGroup(MultiValuedProperty <SecurityPrincipalType> types)
        {
            List <CompositeFilter> list = new List <CompositeFilter>();

            foreach (SecurityPrincipalType securityPrincipalType in types)
            {
                CompositeFilter compositeFilter = null;
                switch (securityPrincipalType)
                {
                case SecurityPrincipalType.User:
                    compositeFilter = new AndFilter(new QueryFilter[]
                    {
                        new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.ObjectCategory, ADUser.ObjectCategoryNameInternal),
                        ADObject.ObjectClassFilter(ADUser.MostDerivedClass, true)
                    });
                    break;

                case SecurityPrincipalType.Group:
                    compositeFilter = new AndFilter(new QueryFilter[]
                    {
                        new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.ObjectCategory, ADGroup.MostDerivedClass),
                        new BitMaskOrFilter(ADGroupSchema.GroupType, (ulong)int.MinValue),
                        new NotFilter(new BitMaskAndFilter(ADGroupSchema.GroupType, 4UL))
                    });
                    break;

                case SecurityPrincipalType.UniversalSecurityGroup:
                    if (!types.Contains(SecurityPrincipalType.Group))
                    {
                        compositeFilter = ExtendedSecurityPrincipalSearchHelper.GenerateTargetFilterForSecurityGroup(GroupTypeFlags.Universal);
                    }
                    break;

                case SecurityPrincipalType.GlobalSecurityGroup:
                    if (!types.Contains(SecurityPrincipalType.Group))
                    {
                        compositeFilter = ExtendedSecurityPrincipalSearchHelper.GenerateTargetFilterForSecurityGroup(GroupTypeFlags.Global);
                    }
                    break;
                }
                if (compositeFilter != null)
                {
                    if (Datacenter.IsMicrosoftHostedOnly(true) && (securityPrincipalType == SecurityPrincipalType.Group || securityPrincipalType == SecurityPrincipalType.UniversalSecurityGroup))
                    {
                        compositeFilter = new AndFilter(new QueryFilter[]
                        {
                            compositeFilter,
                            new OrFilter(new QueryFilter[]
                            {
                                new NotFilter(new BitMaskAndFilter(ADGroupSchema.GroupType, 8UL)),
                                new AndFilter(new QueryFilter[]
                                {
                                    new BitMaskAndFilter(ADGroupSchema.GroupType, 8UL),
                                    new OrFilter(new QueryFilter[]
                                    {
                                        new ExistsFilter(ADRecipientSchema.Alias),
                                        Filters.GetRecipientTypeDetailsFilterOptimization(RecipientTypeDetails.RoleGroup)
                                    })
                                })
                            })
                        });
                    }
                    list.Add(compositeFilter);
                }
            }
            return(new OrFilter(list.ToArray()));
        }
 // Token: 0x06000A39 RID: 2617 RVA: 0x0002219B File Offset: 0x0002039B
 public RecipientIdParameter(ADObject recipient) : base(recipient.Id)
 {
 }
 /// <summary>
 /// Get all the AD objects which is matched with the filter.
 /// </summary>
 /// <param name="adOperator">The AD operator.</param>
 /// <param name="filter">The root AD filter.</param>
 /// <param name="ldapPath">The LDAP path.</param>
 /// <param name="queryScopeType">The query scope type<seealso cref="QueryScopeType"/>.</param>
 /// <returns>All the AD objects which is matched with the filter.</returns>
 public static IList <ADObject> List(IADOperator adOperator, IFilter filter, string ldapPath, QueryScopeType queryScopeType)
 {
     return(ADObject.FindAllByFilter <ADObject>(adOperator, filter, ldapPath, queryScopeType));
 }
 /// <summary>
 /// Get the single AD object which is matched with the filter.
 /// </summary>
 /// <param name="adOperator">The AD operator.</param>
 /// <param name="filter">The root AD filter.</param>
 /// <param name="ldapPath">The LDAP path.</param>
 /// <param name="queryScopeType">The query scope type<seealso cref="QueryScopeType"/>.</param>
 /// <returns>The single AD object which is matched with the filter.</returns>
 public static ADObject SingleAndDefault(IADOperator adOperator, IFilter filter, string ldapPath, QueryScopeType queryScopeType)
 {
     return(ADObject.FindOneByFilter <ADObject>(adOperator, filter, ldapPath, queryScopeType));
 }
Exemple #8
0
 bool IDirectorySession.GetSchemaAndApplyFilter(ADRawEntry adRawEntry, ADScope scope, out ADObject dummyObject, out string[] ldapAttributes, ref QueryFilter filter, ref IEnumerable <PropertyDefinition> properties)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
     dummyObject    = null;
     ldapAttributes = null;
     return(false);
 }
Exemple #9
0
 string[] IDirectorySession.ReplicateSingleObject(ADObject instanceToReplicate, ADObjectId[] sites)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
     return(new string[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;
 }
Exemple #11
0
 QueryFilter IDirectorySession.ApplyDefaultFilters(QueryFilter filter, ADScope scope, ADObject dummyObject, bool applyImplicitFilter)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
     return(filter);
 }
Exemple #12
0
 protected override bool ShouldUpgradeExchangeVersion(ADObject adObject)
 {
     return(base.ShouldUpgradeExchangeVersion(adObject) || adObject.IsModified(ADRecipientSchema.SendModerationNotifications) || adObject.IsModified(ADRecipientSchema.ModerationFlags) || adObject.IsModified(ADRecipientSchema.ModerationEnabled) || base.Fields.IsModified(ADRecipientSchema.ModeratedBy) || base.Fields.IsModified(ADRecipientSchema.ArbitrationMailbox));
 }
 // Token: 0x0600607B RID: 24699 RVA: 0x0014801C File Offset: 0x0014621C
 private bool IsApplicableRecipientTypeDetails(ADObject recipient)
 {
     return(this.targetRecipientTypeDetails == null || this.targetRecipientTypeDetails.Count == 0 || (recipient != null && this.targetRecipientTypeDetails.Contains((RecipientTypeDetails)recipient[ADRecipientSchema.RecipientTypeDetails])));
 }
Exemple #14
0
 // Token: 0x060053D1 RID: 21457 RVA: 0x001312D3 File Offset: 0x0012F4D3
 protected DistributionGroupBase(ADObject dataObject) : base(dataObject)
 {
 }
Exemple #15
0
        // Token: 0x060019BE RID: 6590 RVA: 0x0006C808 File Offset: 0x0006AA08
        internal static QueryFilter SendDeliveryReportsToFilterBuilder(SinglePropertyFilter filter)
        {
            DeliveryReportsReceiver deliveryReportsReceiver = (DeliveryReportsReceiver)ADObject.PropertyValueFromEqualityFilter(filter);

            switch (deliveryReportsReceiver)
            {
            case DeliveryReportsReceiver.None:
                return(new AndFilter(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.NotEqual, ADGroupSchema.ReportToOriginatorEnabled, true),
                    new ComparisonFilter(ComparisonOperator.NotEqual, ADGroupSchema.ReportToManagerEnabled, true)
                }));

            case DeliveryReportsReceiver.Manager:
                return(new ComparisonFilter(ComparisonOperator.Equal, ADGroupSchema.ReportToManagerEnabled, true));

            case DeliveryReportsReceiver.Originator:
                return(new AndFilter(new QueryFilter[]
                {
                    new ComparisonFilter(ComparisonOperator.Equal, ADGroupSchema.ReportToOriginatorEnabled, true),
                    new ComparisonFilter(ComparisonOperator.NotEqual, ADGroupSchema.ReportToManagerEnabled, true)
                }));

            default:
                throw new ADFilterException(DirectoryStrings.ExceptionUnsupportedPropertyValue(ADGroupSchema.SendDeliveryReportsTo.Name, deliveryReportsReceiver));
            }
        }
Exemple #16
0
 bool IDirectorySession.ReplicateSingleObjectToTargetDC(ADObject instanceToReplicate, string targetServerName)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
     return(false);
 }
 /// <summary>
 /// Get all the AD objects which is matched with the filter.
 /// </summary>
 /// <param name="adOperator">The AD operator.</param>
 /// <param name="filter">The root AD filter.</param>
 /// <returns>All the AD objects which is matched with the filter.</returns>
 public static IList <ADObject> List(IADOperator adOperator, IFilter filter)
 {
     return(ADObject.FindAllByFilter <ADObject>(adOperator, filter));
 }
Exemple #18
0
 void IDirectorySession.SaveSecurityDescriptor(ADObject obj, RawSecurityDescriptor sd, bool modifyOwner)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
 }
 /// <summary>
 /// Get the single AD object which is matched with the filter.
 /// </summary>
 /// <param name="adOperator">The AD operator.</param>
 /// <param name="filter">The root AD filter.</param>
 /// <returns>The single AD object which is matched with the filter.</returns>
 public static ADObject SingleAndDefault(IADOperator adOperator, IFilter filter)
 {
     return(ADObject.FindOneByFilter <ADObject>(adOperator, filter));
 }
Exemple #20
0
 bool IDirectorySession.TryVerifyIsWithinScopes(ADObject entry, bool isModification, out ADScopeException exception)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
     exception = null;
     return(true);
 }
Exemple #21
0
        public static LocalizedString GetConfigurableObjectChangedProperties(ConfigurableObject dataObject)
        {
            if (dataObject == null)
            {
                throw new ArgumentNullException("dataObject");
            }
            StringBuilder stringBuilder = new StringBuilder("{ ");
            IList <PropertyDefinition> changedPropertyDefinitions = dataObject.GetChangedPropertyDefinitions();

            for (int i = 0; i < changedPropertyDefinitions.Count; i++)
            {
                if (changedPropertyDefinitions[i] != ADObjectSchema.ObjectState)
                {
                    PropertyDefinition propertyDefinition = changedPropertyDefinitions[i];
                    if (propertyDefinition != ActiveDirectoryServerSchema.AssistantMaintenanceScheduleInternal)
                    {
                        stringBuilder.Append(propertyDefinition.Name);
                        ADPropertyDefinition adpropertyDefinition = propertyDefinition as ADPropertyDefinition;
                        if (adpropertyDefinition != null)
                        {
                            stringBuilder.Append('[');
                            stringBuilder.Append(TaskVerboseStringHelper.RetrieveLDAPPropertyNames(adpropertyDefinition));
                            stringBuilder.Append(']');
                        }
                        stringBuilder.Append('=');
                        if (dataObject[propertyDefinition] is IList)
                        {
                            IList list = (IList)dataObject[propertyDefinition];
                            stringBuilder.Append("{ ");
                            for (int j = 0; j < list.Count; j++)
                            {
                                stringBuilder.Append(TaskVerboseStringHelper.FormatParameterValue(list[j]));
                                if (j + 1 < list.Count)
                                {
                                    stringBuilder.Append(", ");
                                }
                            }
                            stringBuilder.Append(" }");
                        }
                        else
                        {
                            stringBuilder.Append(TaskVerboseStringHelper.FormatParameterValue(dataObject[propertyDefinition]));
                        }
                        stringBuilder.Append(", ");
                    }
                }
            }
            if (stringBuilder.Length > 2)
            {
                stringBuilder.Remove(stringBuilder.Length - 2, 2);
            }
            stringBuilder.Append(" }");
            LocalizedString result = LocalizedString.Empty;

            if (dataObject.Identity != null)
            {
                ADObject adobject = dataObject as ADObject;
                if (adobject != null)
                {
                    result = Strings.VerboseADObjectChangedPropertiesWithDn(adobject.Name, adobject.Id.ToDNString(), stringBuilder.ToString());
                }
                else
                {
                    result = Strings.VerboseADObjectChangedPropertiesWithId(dataObject.Identity.ToString(), stringBuilder.ToString());
                }
            }
            else
            {
                result = Strings.VerboseADObjectChangedProperties(stringBuilder.ToString());
            }
            return(result);
        }
Exemple #22
0
 void IDirectorySession.VerifyIsWithinScopes(ADObject entry, bool isModification)
 {
     FfoDirectorySession.LogNotSupportedInFFO(null);
 }
 protected override bool ShouldUpgradeExchangeVersion(ADObject adObject)
 {
     return(base.Fields.IsModified(AddressListBaseSchema.RecipientFilter) || RecipientFilterHelper.IsRecipientFilterPropertiesModified(adObject, false));
 }
Exemple #24
0
        // Token: 0x06000459 RID: 1113 RVA: 0x0000F8C0 File Offset: 0x0000DAC0
        internal static void VerifyIsWithinConfigWriteScope(ADSessionSettings sessionSettings, ADObject obj, Task.ErrorLoggerDelegate errorHandler)
        {
            IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, false, ConsistencyMode.PartiallyConsistent, sessionSettings, 481, "VerifyIsWithinConfigWriteScope", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\MapiTaskHelper.cs");
            ADScopeException      ex;

            if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(obj, true, out ex))
            {
                errorHandler(new IsOutofConfigWriteScopeException(obj.GetType().ToString(), obj.Name), ExchangeErrorCategory.Client, null);
            }
        }
Exemple #25
0
        private static Dictionary <int, QueryFilter> InitializeStaticRecipientTypeFilterOptimizations()
        {
            Dictionary <int, QueryFilter> dictionary = new Dictionary <int, QueryFilter>(32);

            Filters.RecipientTypeBitVector32 recipientTypeBitVector = default(Filters.RecipientTypeBitVector32);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.DynamicDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.UserMailbox] = true;
            recipientTypeBitVector[RecipientType.MailContact] = true;
            recipientTypeBitVector[RecipientType.MailUniversalDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.MailUniversalSecurityGroup]     = true;
            recipientTypeBitVector[RecipientType.MailUser] = true;
            QueryFilter value = Filters.AllMailableUsersContactsDDLsUniversalGroupsFilter;

            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.Contact]     = true;
            recipientTypeBitVector[RecipientType.MailContact] = true;
            value = ADObject.ObjectClassFilter(ADContact.MostDerivedClass);
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.Group] = true;
            recipientTypeBitVector[RecipientType.MailNonUniversalGroup]          = true;
            recipientTypeBitVector[RecipientType.MailUniversalDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.MailUniversalSecurityGroup]     = true;
            value = ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass);
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.MailNonUniversalGroup]          = true;
            recipientTypeBitVector[RecipientType.MailUniversalDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.MailUniversalSecurityGroup]     = true;
            value = new AndFilter(new QueryFilter[]
            {
                Filters.CreateMailEnabledFilter(true),
                ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass)
            });
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.User]        = true;
            recipientTypeBitVector[RecipientType.MailUser]    = true;
            recipientTypeBitVector[RecipientType.UserMailbox] = true;
            value = ADUser.ImplicitFilterInternal;
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.DynamicDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.UserMailbox] = true;
            recipientTypeBitVector[RecipientType.MailContact] = true;
            recipientTypeBitVector[RecipientType.MailUniversalDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.MailUniversalSecurityGroup]     = true;
            recipientTypeBitVector[RecipientType.MailUser] = true;
            recipientTypeBitVector[RecipientType.MailNonUniversalGroup] = true;
            recipientTypeBitVector[RecipientType.PublicFolder]          = true;
            value = new AndFilter(new QueryFilter[]
            {
                Filters.CreateMailEnabledFilter(true),
                new OrFilter(new QueryFilter[]
                {
                    ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
                    ADObject.ObjectCategoryFilter(ADDynamicGroup.ObjectCategoryNameInternal),
                    ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
                    ADObject.ObjectCategoryFilter(ADPublicFolder.MostDerivedClass)
                })
            });
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.DynamicDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.UserMailbox] = true;
            recipientTypeBitVector[RecipientType.MailContact] = true;
            recipientTypeBitVector[RecipientType.MailUniversalDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.MailUniversalSecurityGroup]     = true;
            recipientTypeBitVector[RecipientType.MailUser] = true;
            recipientTypeBitVector[RecipientType.MailNonUniversalGroup]  = true;
            recipientTypeBitVector[RecipientType.PublicFolder]           = true;
            recipientTypeBitVector[RecipientType.SystemAttendantMailbox] = true;
            recipientTypeBitVector[RecipientType.SystemMailbox]          = true;
            value = new AndFilter(new QueryFilter[]
            {
                Filters.CreateMailEnabledFilter(true),
                new OrFilter(new QueryFilter[]
                {
                    ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
                    ADObject.ObjectCategoryFilter(ADDynamicGroup.ObjectCategoryNameInternal),
                    ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
                    ADObject.ObjectCategoryFilter(ADPublicFolder.MostDerivedClass),
                    ADObject.ObjectCategoryFilter(ADSystemAttendantMailbox.MostDerivedClass),
                    ADObject.ObjectCategoryFilter(ADSystemMailbox.MostDerivedClass)
                })
            });
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.DynamicDistributionGroup]       = true;
            recipientTypeBitVector[RecipientType.MailUniversalDistributionGroup] = true;
            recipientTypeBitVector[RecipientType.MailUniversalSecurityGroup]     = true;
            value = new AndFilter(new QueryFilter[]
            {
                Filters.CreateMailEnabledFilter(true),
                new OrFilter(new QueryFilter[]
                {
                    ADObject.ObjectCategoryFilter(ADDynamicGroup.ObjectCategoryNameInternal),
                    new AndFilter(new QueryFilter[]
                    {
                        ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
                        Filters.CreateUniversalGroupFilter(true)
                    })
                })
            });
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            recipientTypeBitVector[RecipientType.MailContact] = true;
            recipientTypeBitVector[RecipientType.MailUser]    = true;
            value = new AndFilter(new QueryFilter[]
            {
                ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
                Filters.CreateMailEnabledFilter(true),
                new OrFilter(new QueryFilter[]
                {
                    ADObject.ObjectClassFilter(ADContact.MostDerivedClass),
                    Filters.CreateMailboxEnabledFilter(false)
                })
            });
            dictionary.Add(recipientTypeBitVector.Data, value);
            recipientTypeBitVector.Reset();
            return(dictionary);
        }
Exemple #26
0
 protected override bool ShouldUpgradeExchangeVersion(ADObject adObject)
 {
     return(true);
 }
Exemple #27
0
 private static QueryFilter[] InitializeStaticRecipientTypeFilters()
 {
     QueryFilter[] array = new QueryFilter[Filters.RecipientTypeCount];
     array[1] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectClassFilter(ADUser.MostDerivedClass, true),
         ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
         Filters.CreateMailEnabledFilter(false)
     });
     array[2] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectClassFilter(ADUser.MostDerivedClass, true),
         ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
         Filters.CreateMailEnabledFilter(true),
         Filters.CreateMailboxEnabledFilter(true)
     });
     array[3] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectClassFilter(ADUser.MostDerivedClass, true),
         ADObject.ObjectCategoryFilter(ADUser.ObjectCategoryNameInternal),
         Filters.CreateMailEnabledFilter(true),
         Filters.CreateMailboxEnabledFilter(false)
     });
     array[4] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectClassFilter(ADContact.MostDerivedClass),
         Filters.CreateMailEnabledFilter(false)
     });
     array[5] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectClassFilter(ADContact.MostDerivedClass),
         Filters.CreateMailEnabledFilter(true)
     });
     array[6] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
         Filters.CreateMailEnabledFilter(false)
     });
     array[9] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
         Filters.NonUniversalGroupFilter,
         Filters.CreateMailEnabledFilter(true)
     });
     array[7] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
         Filters.UniversalDistributionGroupFilter,
         Filters.CreateMailEnabledFilter(true)
     });
     array[8] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADGroup.MostDerivedClass),
         Filters.UniversalSecurityGroupFilter,
         Filters.CreateMailEnabledFilter(true)
     });
     array[10] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADDynamicGroup.MostDerivedClass),
         Filters.CreateMailEnabledFilter(true)
     });
     array[11] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADPublicFolder.MostDerivedClass),
         Filters.CreateMailEnabledFilter(true)
     });
     array[12] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADPublicDatabase.MostDerivedClass),
         Filters.CreateMailEnabledFilter(true)
     });
     array[13] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADSystemAttendantMailbox.MostDerivedClass),
         Filters.CreateMailEnabledFilter(true)
     });
     array[15] = new AndFilter(new QueryFilter[]
     {
         ADObject.ObjectCategoryFilter(ADMicrosoftExchangeRecipient.MostDerivedClass),
         Filters.CreateMailEnabledFilter(true)
     });
     array[14] = new AndFilter(new QueryFilter[]
     {
         Filters.CreateMailEnabledFilter(true),
         Filters.CreateMailboxEnabledFilter(true),
         new OrFilter(new QueryFilter[]
         {
             ADObject.ObjectCategoryFilter(ADSystemMailbox.MostDerivedClass),
             new AndFilter(new QueryFilter[]
             {
                 ADUser.ImplicitFilterInternal,
                 new TextFilter(ADObjectSchema.Name, "SystemMailbox{", MatchOptions.Prefix, MatchFlags.Default)
             })
         })
     });
     array[16] = ADComputerRecipient.ImplicitFilterInternal;
     return(array);
 }
Exemple #28
0
        private async void setChildrenButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (forestTreeView.SelectedItem == null)
                {
                    return;
                }

                EnableGUIWait();

                // Set GUI
                ADObject parent = (ADObject)forestTreeView.SelectedItem;
                parent.GetAllChildren().ForEach(child => child.Tier = parent.Tier);
                forestTreeView.Focus();

                if (parent.Type.Equals(ADObjectType.Domain))
                {
                    // Delete current tier label
                    await DBConnection.Query(@"
                        CALL db.labels()
                        YIELD label WHERE label STARTS WITH 'Tier'
                        WITH COLLECT(label) AS labels
                        MATCH (n {domain:'" + parent.Name + @"'}) WHERE EXISTS(n.distinguishedname)
                        WITH COLLECT(n) AS nodes, labels
                        CALL apoc.create.removeLabels(nodes, labels) YIELD node
                        RETURN NULL
                    ");

                    // Add new tier label
                    await DBConnection.Query(@"
                        MATCH (n {domain:'" + parent.Name + @"'}) WHERE EXISTS(n.distinguishedname)
                        WITH COLLECT(n) AS nodes
                        CALL apoc.create.addLabels(nodes, ['Tier" + parent.Tier + @"']) YIELD node
                        RETURN NULL
                    ");
                }
                else
                {
                    // Delete current tier label
                    await DBConnection.Query(@"
                        CALL db.labels()
                        YIELD label WHERE label STARTS WITH 'Tier'
                        WITH COLLECT(label) AS labels
                        MATCH (n) WHERE n.distinguishedname ENDS WITH '," + parent.Distinguishedname + @"'
                        WITH COLLECT(n) AS nodes, labels
                        CALL apoc.create.removeLabels(nodes, labels) YIELD node
                        RETURN NULL
                    ");

                    // Add new tier label
                    await DBConnection.Query(@"
                        MATCH (n) WHERE n.distinguishedname ENDS WITH '," + parent.Distinguishedname + @"'
                        WITH COLLECT(n) AS nodes
                        CALL apoc.create.addLabels(nodes, ['Tier" + parent.Tier + @"']) YIELD node
                        RETURN NULL
                    ");
                }

                DisableGUIWait();
            }
            catch (Exception err)
            {
                // Error
                MessageBox.Show(err.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                DisableGUIWait();
                MainWindow.BackToConnectPage();
            }
        }
Exemple #29
0
        private bool GetADAcctResPrpProcessCSRoutine()
        {
            ADResultantPasswordReplicationPolicy aDResultantPasswordReplicationPolicy = ADResultantPasswordReplicationPolicy.DenyExplicit;
            int?value;

            this._partitionPath     = this._cmdletParameters["Partition"] as string;
            this._identityADAccount = this._cmdletParameters["Identity"] as ADAccount;
            this._targetDCAccount   = this._cmdletParameters["DomainController"] as ADDomainController;
            base.SetPipelinedSessionInfo(this._identityADAccount.SessionInfo);
            CmdletSessionInfo cmdletSessionInfo = base.GetCmdletSessionInfo();

            if (cmdletSessionInfo.ADRootDSE.IsWindows2008AndAbove())
            {
                if (!cmdletSessionInfo.ADRootDSE.IsWritable())
                {
                    object[] dNSHostName = new object[1];
                    dNSHostName[0] = cmdletSessionInfo.ADRootDSE.DNSHostName;
                    base.WriteWarning(string.Format(CultureInfo.CurrentCulture, StringResources.WarningResultantPRPNotAccurateOnRODC, dNSHostName));
                }
                ADDomainControllerFactory <ADDomainController> aDDomainControllerFactory = new ADDomainControllerFactory <ADDomainController>();
                aDDomainControllerFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                ADAccountFactory <ADAccount> aDAccountFactory = new ADAccountFactory <ADAccount>();
                aDAccountFactory.SetCmdletSessionInfo(cmdletSessionInfo);
                ADObject         directoryObjectFromIdentity = aDDomainControllerFactory.GetDirectoryObjectFromIdentity(this._targetDCAccount, cmdletSessionInfo.DefaultPartitionPath);
                ADObject         aDObject          = aDAccountFactory.GetDirectoryObjectFromIdentity(this._identityADAccount, cmdletSessionInfo.DefaultPartitionPath);
                ADObjectSearcher distinguishedName = SearchUtility.BuildSearcher(cmdletSessionInfo.ADSessionInfo, directoryObjectFromIdentity.DistinguishedName, ADSearchScope.Base);
                using (distinguishedName)
                {
                    distinguishedName.Filter = ADOPathUtil.CreateFilterClause(ADOperator.Like, "objectClass", "*");
                    distinguishedName.Properties.Add("msDS-IsUserCachableAtRodc");
                    distinguishedName.InputDN = aDObject.DistinguishedName;
                    ADObject aDObject1 = distinguishedName.FindOne();
                    if (aDObject1["msDS-IsUserCachableAtRodc"] == null)
                    {
                        int?nullable = null;
                        value = nullable;
                    }
                    else
                    {
                        value = (int?)aDObject1["msDS-IsUserCachableAtRodc"].Value;
                    }
                    int?nullable1 = value;
                    if (nullable1.HasValue)
                    {
                        if (!Utils.TryParseEnum <ADResultantPasswordReplicationPolicy>(nullable1.ToString(), out aDResultantPasswordReplicationPolicy))
                        {
                            DebugLogger.LogInfo("GetADAccountResultantPasswordReplicationPolicy", string.Format("Error parsing resultant prp: {0} for account {1} on RODC {2}", aDResultantPasswordReplicationPolicy, aDObject.DistinguishedName, directoryObjectFromIdentity.DistinguishedName));
                            base.WriteObject(ADResultantPasswordReplicationPolicy.Unknown);
                        }
                        else
                        {
                            base.WriteObject(aDResultantPasswordReplicationPolicy);
                        }
                    }
                    else
                    {
                        base.WriteObject(ADResultantPasswordReplicationPolicy.Unknown);
                    }
                }
                return(true);
            }
            else
            {
                base.WriteError(new ErrorRecord(new ArgumentException(StringResources.ErrorResultantPRPSpecifyWindows2008OrAbove), "GetADAccountResultantPasswordReplicationPolicy:ProcessRecord", ErrorCategory.InvalidData, null));
                return(false);
            }
        }
Exemple #30
0
 protected DropDownItemData(ADObject adObject) : base(adObject)
 {
 }