// Token: 0x06000911 RID: 2321 RVA: 0x0001F9CC File Offset: 0x0001DBCC internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { if (!typeof(Container).IsAssignableFrom(typeof(T)) && !typeof(ADContainer).IsAssignableFrom(typeof(T))) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); if (!wrapper.HasElements()) { notFoundReason = null; QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, base.RawIdentity); wrapper = EnumerableWrapper <T> .GetWrapper(base.PerformPrimarySearch <T>(filter, ((IConfigurationSession)session).GetOrgContainerId(), session, false, optionalData)); } return(wrapper); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); TDataObject dataObject = this.DataObject; ADObjectId parent = dataObject.Id.Parent; ADSessionSettings adsessionSettings = ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(parent); if (!parent.Equals(ADSession.GetRootDomainNamingContext(adsessionSettings.GetAccountOrResourceForestFqdn()))) { IDirectorySession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(base.DomainController, true, ConsistencyMode.PartiallyConsistent, null, adsessionSettings, 264, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\BaseTasks\\NewAdObjectTask.cs"); tenantOrTopologyConfigurationSession.UseConfigNC = ((IDirectorySession)base.DataSession).UseConfigNC; ADRawEntry adrawEntry = tenantOrTopologyConfigurationSession.ReadADRawEntry(parent, new PropertyDefinition[] { ADObjectSchema.ExchangeVersion, ADObjectSchema.ObjectClass }); if (adrawEntry == null) { if (string.IsNullOrEmpty(base.DomainController)) { TDataObject dataObject2 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentNotFound(dataObject2.Name, parent.ToString())), (ErrorCategory)1003, null); } else { TDataObject dataObject3 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentNotFoundOnDomainController(dataObject3.Name, base.DomainController, parent.ToString(), parent.DomainId.ToString())), (ErrorCategory)1003, null); } } ExchangeObjectVersion exchangeObjectVersion = (ExchangeObjectVersion)adrawEntry[ADObjectSchema.ExchangeVersion]; MultiValuedProperty <string> multiValuedProperty = (MultiValuedProperty <string>)adrawEntry[ADObjectSchema.ObjectClass]; TDataObject dataObject4 = this.DataObject; if (dataObject4.ExchangeVersion.IsOlderThan(exchangeObjectVersion) && !multiValuedProperty.Contains(Organization.MostDerivedClass) && this.EnforceExchangeObjectVersion) { TDataObject dataObject5 = this.DataObject; string name = dataObject5.Name; TDataObject dataObject6 = this.DataObject; base.WriteError(new TaskException(Strings.ErrorParentHasNewerVersion(name, dataObject6.ExchangeVersion.ToString(), exchangeObjectVersion.ToString())), (ErrorCategory)1004, null); } } if (base.IsVerboseOn) { base.WriteVerbose(TaskVerboseStringHelper.GetConfigurableObjectChangedProperties(this.DataObject)); } base.InternalProcessRecord(); TaskLogger.LogExit(); }
protected override void WriteResult(IConfigurable dataObject) { TaskLogger.LogEnter(); IDirectorySession directorySession = (IDirectorySession)base.DataSession; if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(directorySession, (ADObject)dataObject)) { directorySession = TaskHelper.UnderscopeSessionToOrganization(directorySession, ((ADObject)dataObject).OrganizationId, true); } ActiveDirectorySecurity activeDirectorySecurity = PermissionTaskHelper.ReadAdSecurityDescriptor((ADRawEntry)dataObject, directorySession, new Task.TaskErrorLoggingDelegate(base.WriteError)); AuthorizationRuleCollection accessRules = activeDirectorySecurity.GetAccessRules(true, true, typeof(SecurityIdentifier)); foreach (object obj in accessRules) { ActiveDirectoryAccessRule activeDirectoryAccessRule = (ActiveDirectoryAccessRule)obj; if (this.Trustee == null || this.trusteeSid == activeDirectoryAccessRule.IdentityReference) { RecipientAccessRight?recipientAccessRight = this.FilterByRecipientAccessRights(activeDirectoryAccessRule, this.AccessRights); if (recipientAccessRight != null) { string text = string.Empty; if (Globals.IsDatacenter && base.TenantGlobalCatalogSession != null) { try { SecurityIdentifier sId = (SecurityIdentifier)activeDirectoryAccessRule.IdentityReference; ADRecipient adrecipient = base.TenantGlobalCatalogSession.FindBySid(sId); if (adrecipient != null) { text = ((!string.IsNullOrEmpty(adrecipient.DisplayName)) ? adrecipient.DisplayName : adrecipient.Name); } } catch { } } if (string.IsNullOrEmpty(text)) { text = RecipientPermissionTaskHelper.GetFriendlyNameOfSecurityIdentifier((SecurityIdentifier)activeDirectoryAccessRule.IdentityReference, base.TenantGlobalCatalogSession, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); } RecipientPermission dataObject2 = new RecipientPermission(activeDirectoryAccessRule, ((ADRawEntry)dataObject).Id, text, recipientAccessRight.Value); base.WriteResult(dataObject2); } } } TaskLogger.LogExit(); }
// Token: 0x06000B8D RID: 2957 RVA: 0x00024974 File Offset: 0x00022B74 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { if (session == null) { throw new ArgumentNullException("session"); } if (subTreeSession == null) { throw new ArgumentNullException("subTreeSession"); } if (!typeof(T).IsAssignableFrom(typeof(ADRecipient)) && !typeof(T).IsAssignableFrom(typeof(RoleAssignmentPolicy))) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } bool flag = session is IConfigurationSession && subTreeSession is IConfigurationSession; bool flag2 = session is IRecipientSession && subTreeSession is IRecipientSession; if (flag) { if (typeof(T).IsAssignableFrom(typeof(RoleAssignmentPolicy))) { if (this.policyParameter == null) { this.policyParameter = ((base.InternalADObjectId != null) ? new MailboxPolicyIdParameter(base.InternalADObjectId) : new MailboxPolicyIdParameter(base.RawIdentity)); } return(this.policyParameter.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); } throw new ArgumentException("Argument Mismatch. Type T is located on Config NC and sessions aren't of IConfigurationSession type."); } else { if (!flag2) { throw new ArgumentException(string.Format("Invalid Session Type. Session isn't of type 'RecipientSession' or 'SystemConfigurationSession'. Session type is '{0}'", session.GetType().Name), "session"); } if (typeof(T).IsAssignableFrom(typeof(ADRecipient))) { if (this.spParameter == null) { this.spParameter = ((base.InternalADObjectId != null) ? new SecurityPrincipalIdParameter(base.InternalADObjectId) : new SecurityPrincipalIdParameter(base.RawIdentity)); } return(this.spParameter.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); } throw new ArgumentException("Argument Mismatch. Type T is located on Domain NC and sessions aren't of IRecipientSession type."); } }
internal ADVirtualListView(IDirectorySession session, ADObjectId rootId, ADObjectId[] addressListIds, SortBy sortBy, int rowsToPrefetch, IEnumerable <PropertyDefinition> properties) : base(session, rootId, QueryScope.SubTree, sortBy) { if (properties == null) { throw new ArgumentNullException("properties"); } if (sortBy == null) { throw new ArgumentNullException("sortBy"); } if (rowsToPrefetch < 1) { throw new ArgumentOutOfRangeException("rowsToPrefetch"); } this.rowsToPrefetch = rowsToPrefetch; QueryFilter[] array; if (addressListIds == null) { array = new QueryFilter[2]; array[0] = new ExistsFilter(ADRecipientSchema.AddressListMembership); } else { array = new QueryFilter[addressListIds.Length + 1]; for (int i = 0; i < addressListIds.Length; i++) { array[i] = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.AddressListMembership, addressListIds[i]); } } array[array.Length - 1] = new ExistsFilter(ADRecipientSchema.DisplayName); QueryFilter queryFilter = new AndFilter(array); QueryFilter queryFilter2 = (addressListIds == null) ? queryFilter : new ExistsFilter(ADObjectSchema.ObjectClass); this.requestedProperties = properties; ADScope readScope = session.GetReadScope(rootId, ADVirtualListView.dummyADRawEntry); ADObject adobject; string[] ldapAttributes; session.GetSchemaAndApplyFilter(ADVirtualListView.dummyADRawEntry, readScope, out adobject, out ldapAttributes, ref queryFilter2, ref properties); base.LdapAttributes = ldapAttributes; this.properties = properties; base.LdapFilter = LdapFilterBuilder.LdapFilterFromQueryFilter((addressListIds == null) ? queryFilter2 : queryFilter, false, base.Session.SessionSettings.PartitionSoftLinkMode, base.Session.SessionSettings.IsTenantScoped); this.vlvRequestControl = new VlvRequestControl(); this.vlvRequestControl.AfterCount = this.rowsToPrefetch; base.DirectoryControls.Add(this.vlvRequestControl); }
// Token: 0x06000EEA RID: 3818 RVA: 0x0002B5C8 File Offset: 0x000297C8 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); if (!typeof(T).IsAssignableFrom(typeof(ExtendedSecurityPrincipal))) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } if (session == null) { throw new ArgumentNullException("session"); } IEnumerable <T> result = ExtendedSecurityPrincipalSearchHelper.PerformSearch(new ExtendedSecurityPrincipalSearcher(this.FindObjects), (IConfigDataProvider)session, rootId, (this.IncludeDomainLocalFrom != null) ? this.IncludeDomainLocalFrom.Id : null, this.Types).Cast <T>(); TaskLogger.LogExit(); notFoundReason = null; return(result); }
internal static SecurityIdentifier[] GetServerAdmins(Server server, IDirectorySession session, Task.TaskErrorLoggingDelegate logError) { List <SecurityIdentifier> list = new List <SecurityIdentifier>(); ActiveDirectorySecurity activeDirectorySecurity = PermissionTaskHelper.ReadAdSecurityDescriptor(server, session, logError); AuthorizationRuleCollection accessRules = activeDirectorySecurity.GetAccessRules(true, false, typeof(SecurityIdentifier)); foreach (object obj in accessRules) { ActiveDirectoryAccessRule activeDirectoryAccessRule = (ActiveDirectoryAccessRule)obj; if (activeDirectoryAccessRule.ActiveDirectoryRights == ActiveDirectoryRights.GenericAll) { SecurityIdentifier item = (SecurityIdentifier)activeDirectoryAccessRule.IdentityReference; list.Add(item); } } return(list.ToArray()); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); notFoundReason = null; List <T> list = new List <T>(); try { if (typeof(T) != typeof(SystemMessage)) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } if (session == null) { throw new ArgumentNullException("session"); } if (string.IsNullOrEmpty(base.RawIdentity)) { throw new InvalidOperationException(Strings.ErrorOperationOnInvalidObject); } if (base.InternalADObjectId != null) { return(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); } ADObjectId adobjectId = rootId; foreach (string unescapedCommonName in this.relativeDnParts) { adobjectId = adobjectId.GetChildId(unescapedCommonName); } if (optionalData != null && optionalData.AdditionalFilter != null) { throw new NotSupportedException("Supplying Additional Filters without an ADObjectId is not currently supported by this IdParameter."); } IConfigurable configurable = ((IConfigDataProvider)session).Read <T>(adobjectId); if (configurable != null) { list.Add((T)((object)configurable)); } } finally { TaskLogger.LogExit(); } return(list); }
private IEnumerable <ExchangePrincipal> GetSyncMailboxPrincipals() { IDirectorySession session = null; foreach (Guid database in this.FindLocalDatabases()) { if (session == null) { ADSessionSettings sessionSettings = ADSessionSettings.FromRootOrgScopeSet(); session = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, sessionSettings, 191, "GetSyncMailboxPrincipals", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\UnifiedPolicy\\NotificationLoader.cs"); } foreach (ExchangePrincipal principal in this.GetSyncMailboxPrincipals(database, session)) { yield return(principal); } } yield break; }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); if (wrapper.HasElements()) { return(wrapper); } SecurityPrincipalIdParameter securityPrincipalIdParameter = new SecurityPrincipalIdParameter(base.RawIdentity); OptionalIdentityData optionalIdentityData = (optionalData == null) ? new OptionalIdentityData() : optionalData.Clone(); optionalIdentityData.AdditionalFilter = QueryFilter.AndTogether(new QueryFilter[] { optionalIdentityData.AdditionalFilter, RecipientIdParameter.GetRecipientTypeFilter(this.RecipientTypes) }); return(securityPrincipalIdParameter.GetObjects <T>(rootId, session, subTreeSession, optionalIdentityData, out notFoundReason)); }
// Token: 0x06000DC0 RID: 3520 RVA: 0x00029194 File Offset: 0x00027394 private EnumerableWrapper <T> SearchByObjectId <T>(ADObjectId objectId, IDirectorySession session, OptionalIdentityData optionalData, QueryFilter basicFilter) where T : IConfigurable, new() { EnumerableWrapper <T> result = EnumerableWrapper <T> .Empty; try { IEnumerable <T> enumerable = base.PerformPrimarySearch <T>(QueryFilter.AndTogether(new QueryFilter[] { basicFilter, new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Id, objectId) }), null, session, false, optionalData); result = EnumerableWrapper <T> .GetWrapper(enumerable); } catch (ADReferralException) { } return(result); }
// Token: 0x06000DCD RID: 3533 RVA: 0x00029468 File Offset: 0x00027668 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { notFoundReason = null; EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); if (!wrapper.HasElements()) { wrapper = EnumerableWrapper <T> .GetWrapper(this.TryGetObjectsFromDC <T>(rootId, subTreeSession, optionalData)); } if (!wrapper.HasElements() && !Guid.Empty.Equals(this.guid) && typeof(T).IsAssignableFrom(typeof(ADGroup))) { ADObjectId containerId; if (session.SessionSettings.CurrentOrganizationId.Equals(OrganizationId.ForestWideOrgId)) { containerId = session.GetConfigurationNamingContext(); } else { containerId = session.SessionSettings.CurrentOrganizationId.ConfigurationUnit; } bool useGlobalCatalog = session.UseGlobalCatalog; bool useConfigNC = session.UseConfigNC; ADGroup adgroup = null; try { session.UseGlobalCatalog = true; session.UseConfigNC = false; adgroup = session.ResolveWellKnownGuid <ADGroup>(this.guid, containerId); } finally { session.UseGlobalCatalog = useGlobalCatalog; session.UseConfigNC = useConfigNC; } if (adgroup != null) { wrapper = EnumerableWrapper <T> .GetWrapper(new List <ADGroup>(1) { adgroup }.Cast <T>()); } } return(wrapper); }
public IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where T : IConfigurable, new() { if (session == null) { throw new ArgumentNullException("session"); } if (!(session is IDirectorySession)) { throw new ArgumentException("Session should be an IDirectorySession", "session"); } if (rootId != null && !(rootId is ADObjectId)) { throw new ArgumentException("RootId must be an ADObjectId", "rootId"); } IDirectorySession directorySession = (IDirectorySession)session; IDirectorySession directorySession2 = null; if (!(this is OrganizationIdParameter) && VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && rootId == null && ADSessionSettings.GetProcessServerSettings() == null && directorySession is IConfigurationSession) { IConfigurationSession configurationSession = directorySession as IConfigurationSession; ADObjectId configurationUnitsRoot = directorySession.GetConfigurationUnitsRoot(); bool flag = !string.IsNullOrEmpty(this.rawIdentity) && this.rawIdentity.IndexOf("\\") != -1; if (this.InternalADObjectId != null) { flag = !string.IsNullOrEmpty(this.InternalADObjectId.DistinguishedName); } if (!flag && configurationSession.UseConfigNC && !configurationUnitsRoot.IsDescendantOf(directorySession.GetConfigurationNamingContext()) && typeof(ADConfigurationObject).IsAssignableFrom(typeof(T)) && !typeof(ADNonExchangeObject).IsAssignableFrom(typeof(T))) { T t = (default(T) == null) ? Activator.CreateInstance <T>() : default(T); ADObject adobject = t as ADObject; ObjectScopeAttribute objectScopeAttribute; bool flag2 = adobject.IsApplicableToTenant(out objectScopeAttribute); if (directorySession.SessionSettings.ExecutingUserOrganizationId.Equals(OrganizationId.ForestWideOrgId) && directorySession.SessionSettings.CurrentOrganizationId.Equals(directorySession.SessionSettings.ExecutingUserOrganizationId) && flag2) { directorySession2 = directorySession; } } } if (directorySession2 == null) { directorySession2 = ADSession.RescopeSessionToTenantSubTree(directorySession); } return(this.GetObjects <T>((ADObjectId)rootId, directorySession, directorySession2, optionalData, out notFoundReason)); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { DistributionGroupIdParameter @object = new DistributionGroupIdParameter(base.RawIdentity); ReducedRecipient object2 = base.GetObject <ReducedRecipient>(rootId, session, subTreeSession, optionalData, new RecipientIdParameter.GetObjectsDelegate <ReducedRecipient>(@object.GetObjects <ReducedRecipient>), out notFoundReason); if (object2 == null) { return(EnumerableWrapper <T> .Empty); } if (object2.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox || object2.RecipientTypeDetails == RecipientTypeDetails.RemoteGroupMailbox) { throw new ArgumentException(Strings.WrongTypeMailboxRecipient(object2.Id.ToString())); } IDirectorySession directorySession = TaskHelper.UnderscopeSessionToOrganization(session, object2.OrganizationId, true); IDirectorySession reducedRecipientSession = DirectorySessionFactory.Default.GetReducedRecipientSession((IRecipientSession)directorySession, 155, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\RecipientParameters\\DistributionGroupMemberIdParameter.cs"); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.MemberOfGroup, object2.Id); return(base.PerformPrimarySearch <T>(filter, null, reducedRecipientSession, true, optionalData)); }
private IEnumerable <TObject> RescopeSessionByResultObjects <TObject>(IEnumerable <TObject> dataObjects) where TObject : IConfigurable, new() { if (typeof(ADObject).IsAssignableFrom(typeof(TObject)) && base.DataSession is IDirectorySession) { List <TObject> list = new List <TObject>(dataObjects); if (list.Count > 0) { ADObject adobject = list[0] as ADObject; IDirectorySession directorySession = base.DataSession as IDirectorySession; if (directorySession != null && adobject != null && adobject.OrganizationId != null && TaskHelper.ShouldUnderscopeDataSessionToOrganization(directorySession, adobject)) { base.UnderscopeDataSession(adobject.OrganizationId); base.CurrentOrganizationId = adobject.OrganizationId; } } dataObjects = list; } return(dataObjects); }
// Token: 0x060008C1 RID: 2241 RVA: 0x0001EC1C File Offset: 0x0001CE1C internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { if (typeof(T) != typeof(ClientAccessArray)) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); if (!wrapper.HasElements() && this.fqdn != null) { QueryFilter filter = new OrFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ClientAccessArraySchema.Fqdn, this.fqdn), new ComparisonFilter(ComparisonOperator.Equal, ClientAccessArraySchema.ExchangeLegacyDN, this.fqdn) }); wrapper = EnumerableWrapper <T> .GetWrapper(base.PerformPrimarySearch <T>(filter, rootId, session, true, optionalData)); } return(wrapper); }
internal static ADObjectId GetExecutingUserAndCheckGroupOwnership(Task task, IDirectorySession dataSession, IRecipientSession gcSession, ADGroup group, bool bypassSecurityGroupManagerCheck) { ADScopeException ex2 = null; ADObjectId adobjectId = null; bool flag = task.TryGetExecutingUserId(out adobjectId); LocalizedException ex = null; ExchangeErrorCategory errCategory = ExchangeErrorCategory.Client; object targetObj = null; bool flag2 = false; if (flag && adobjectId != null && !dataSession.TryVerifyIsWithinScopes(group, true, out ex2)) { task.WriteVerbose(Strings.VerboseDGOwnershipDeepSearch(adobjectId.ToString(), group.Identity.ToString())); RecipientTaskHelper.ValidateUserIsGroupManager(adobjectId, group, delegate(LocalizedException exception, ExchangeErrorCategory category, object target) { ex = exception; errCategory = category; targetObj = target; }, true, gcSession); flag2 = true; group.IsExecutingUserGroupOwner = (ex == null); } if (RecipientType.MailUniversalSecurityGroup == group.RecipientType && !bypassSecurityGroupManagerCheck) { if (!flag) { task.WriteError(new RecipientTaskException(Strings.ErrorExecutingUserOutOfTargetOrg(task.MyInvocation.MyCommand.Name)), ExchangeErrorCategory.Client, group.Identity.ToString()); } if (!flag2) { task.WriteVerbose(Strings.VerboseDGOwnershipDeepSearch(adobjectId.ToString(), group.Identity.ToString())); RecipientTaskHelper.ValidateUserIsGroupManager(adobjectId, group, new Task.ErrorLoggerDelegate(task.WriteError), true, gcSession); group.IsExecutingUserGroupOwner = true; } else if (ex != null) { task.WriteError(ex, errCategory, targetObj); } } group.propertyBag.ResetChangeTracking(ADGroupSchema.IsExecutingUserGroupOwner); return(adobjectId); }
// Token: 0x06000C7A RID: 3194 RVA: 0x00027404 File Offset: 0x00025604 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); if (session == null) { throw new ArgumentNullException("session"); } if (!(session is IConfigurationSession)) { throw new ArgumentException(Strings.ErrorInvalidType(session.GetType().Name), "type"); } notFoundReason = null; EnumerableWrapper <T> result = EnumerableWrapper <T> .Empty; if (this.IsWildcardDefined(base.RawIdentity)) { notFoundReason = new LocalizedString?(Strings.ErrorOrganizationWildcard); return(result); } OrganizationId organizationId = this.ResolveOrganizationId(); if (!OrganizationId.ForestWideOrgId.Equals(organizationId)) { ADSessionSettings adsessionSettings = ADSessionSettings.FromCustomScopeSet(ScopeSet.ResolveUnderScope(organizationId, session.SessionSettings.ScopeSet), session.SessionSettings.RootOrgId, organizationId, session.SessionSettings.ExecutingUserOrganizationId, false); adsessionSettings.TenantConsistencyMode = TenantConsistencyMode.IncludeRetiredTenants; ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(session.DomainController, session.ReadOnly, session.ConsistencyMode, session.NetworkCredential, adsessionSettings, 257, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\TenantRelocationRequestIdParameter.cs"); tenantConfigurationSession.UseConfigNC = session.UseConfigNC; tenantConfigurationSession.UseGlobalCatalog = session.UseGlobalCatalog; if (typeof(TenantRelocationRequest).Equals(typeof(T)) && organizationId.ConfigurationUnit != null) { List <TenantRelocationRequest> list = new List <TenantRelocationRequest>(); TenantRelocationRequest[] array = tenantConfigurationSession.Find <TenantRelocationRequest>(organizationId.ConfigurationUnit, QueryScope.SubTree, TenantRelocationRequest.TenantRelocationRequestFilter, null, 1); if (array != null && array.Length > 0) { list.Add(array[0]); result = EnumerableWrapper <T> .GetWrapper((IEnumerable <T>) list, this.GetEnumerableFilter <T>()); } } } TaskLogger.LogExit(); return(result); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { var func = null; var func2 = null; var func3 = null; Func <DatabaseCopy, int> func4 = null; if (!typeof(DatabaseCopy).IsAssignableFrom(typeof(T))) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } new List <T>(); notFoundReason = null; if (base.InternalADObjectId != null) { return(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); } IEnumerable <DatabaseCopy> enumerable; if (this.DatabaseName.Equals("*")) { enumerable = from dbCopy in base.PerformPrimarySearch <DatabaseCopy>(base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, this.ServerName), rootId, session, true, optionalData) where dbCopy.IsValidDatabaseCopy(this.AllowInvalid) select dbCopy; } else { IEnumerable <MiniDatabase> source = this.PerformSearch <MiniDatabase>(base.CreateWildcardOrEqualFilter(ADObjectSchema.Name, this.DatabaseName), null, session, true); if (func == null) { func = ((MiniDatabase db) => new { db = db, tmpRootId = (db.Id ?? new ADObjectId(db.Name)) }); } var source2 = source.Select(func); var collectionSelector = < > h__TransparentIdentifier0 => this.PerformPrimarySearch <DatabaseCopy>(this.CreateWildcardOrEqualFilter(ADObjectSchema.Name, this.ServerName), <> h__TransparentIdentifier0.tmpRootId, session, true, optionalData); if (func2 == null) { func2 = ((< > h__TransparentIdentifier0, DatabaseCopy dbCopy) => new {
internal IEnumerable <T> GetExactMatchObjects <T>(ADObjectId rootId, IDirectorySession session, OptionalIdentityData optionalData) where T : IConfigurable, new() { EnumerableWrapper <T> enumerableWrapper = EnumerableWrapper <T> .Empty; ADObjectId identity; if (this.InternalADObjectId != null) { enumerableWrapper = EnumerableWrapper <T> .GetWrapper(this.GetADObjectIdObjects <T>(this.InternalADObjectId, rootId, session, optionalData)); } else if (ADIdParameter.TryResolveCanonicalName(this.RawIdentity, out identity)) { enumerableWrapper = EnumerableWrapper <T> .GetWrapper(this.GetADObjectIdObjects <T>(identity, rootId, session, optionalData)); if (enumerableWrapper.HasElements()) { this.UpdateInternalADObjectId(identity); } } return(enumerableWrapper); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { if (typeof(T) != typeof(AddressBookBase)) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } if (session == null) { throw new ArgumentNullException("session"); } IConfigurationSession scSession = session as IConfigurationSession; if ("\\" == base.RawIdentity) { notFoundReason = null; ADObjectId rootContainerId = AddressListIdParameter.GetRootContainerId(scSession); return(EnumerableWrapper <T> .GetWrapper(base.GetADObjectIdObjects <T>(rootContainerId, rootId, subTreeSession, optionalData), this.GetEnumerableFilter <T>())); } return(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason)); }
// Token: 0x06001A7D RID: 6781 RVA: 0x0006EDC8 File Offset: 0x0006CFC8 public virtual Result <TEntry> ReadSecurityDescriptor(ProxyAddress proxyAddress) { if (proxyAddress == null) { throw new ArgumentNullException("proxyAddress"); } Result <TEntry> result = this.FindAndCacheRecipient(proxyAddress); if (result.Data != null) { IDirectorySession adsession = this.ADSession; TEntry data = result.Data; RawSecurityDescriptor rawSecurityDescriptor = adsession.ReadSecurityDescriptor(data.Id); lock (result.Data) { result.Data.propertyBag.SetField(ADObjectSchema.NTSecurityDescriptor, SecurityDescriptor.FromRawSecurityDescriptor(rawSecurityDescriptor)); } } return(result); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(session.DomainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 104, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Configuration\\src\\ObjectModel\\IdentityParameter\\SystemAttendantIdParameter.cs"); IEnumerable <Server> objects = base.GetObjects <Server>(rootId, topologyConfigurationSession, topologyConfigurationSession, null, out notFoundReason); List <T> list = new List <T>(); foreach (Server server in objects) { ADObjectId childId = server.Id.GetChildId("Microsoft System Attendant"); QueryFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.ObjectCategory, "exchangeAdminService"); IEnumerable <ADRecipient> enumerable = base.PerformPrimarySearch <ADRecipient>(filter, childId, session, true, optionalData); int num = 0; foreach (ADRecipient adrecipient in enumerable) { list.Add((T)((object)adrecipient)); num++; } } return(list); }
private static T FindFirstMatchingObject <T>(QueryFilter filter, bool includeAccountForestRootOrg, bool includeResourceForest, bool useGC, ConsistencyMode consistencyMode, bool useRecipientSession, bool includeSoftDeletedObject, bool includeSecondaryPartitions) where T : ADObject, new() { IEnumerable <ADSessionSettings> enumerable = PartitionDataAggregator.CreateSessionSettingsCollection(includeAccountForestRootOrg, includeResourceForest, includeSecondaryPartitions); foreach (ADSessionSettings adsessionSettings in enumerable) { if (includeSoftDeletedObject) { adsessionSettings.IncludeSoftDeletedObjects = true; } IDirectorySession directorySession = PartitionDataAggregator.GetDirectorySession(consistencyMode, useRecipientSession, adsessionSettings); directorySession.UseGlobalCatalog = useGC; T[] array = directorySession.Find <T>(null, QueryScope.SubTree, filter, null, 1); if (array != null && array.Length != 0) { return(array[0]); } } return(default(T)); }
private static IEnumerable <T> FindPagedAllMatchingObjects <T>(QueryFilter filter, bool includeAccountForestRootOrg, bool includeResourceForest, bool useGC, ConsistencyMode consistencyMode, bool useRecipientSession, bool includeSoftDeletedObject, bool includeSecondaryPartitions) where T : ADObject, new() { IEnumerable <ADSessionSettings> sessionSettingsCollection = PartitionDataAggregator.CreateSessionSettingsCollection(includeAccountForestRootOrg, includeResourceForest, includeSecondaryPartitions); foreach (ADSessionSettings sessionSettings in sessionSettingsCollection) { if (includeSoftDeletedObject) { sessionSettings.IncludeSoftDeletedObjects = true; } IDirectorySession session = PartitionDataAggregator.GetDirectorySession(consistencyMode, useRecipientSession, sessionSettings); session.UseGlobalCatalog = useGC; ADPagedReader <T> reader = session.FindPaged <T>(null, QueryScope.SubTree, filter, null, 0, null); foreach (T result in reader) { yield return(result); } } yield break; }
// Token: 0x06000848 RID: 2120 RVA: 0x0001E0B4 File Offset: 0x0001C2B4 internal string GetCanonicalName(IDirectorySession session) { if (session == null) { throw new ArgumentNullException("session"); } if (this.canonicalName == null) { if (base.InternalADObjectId == null || string.IsNullOrEmpty(base.InternalADObjectId.DistinguishedName)) { this.GetDistinguishedName(session); } this.canonicalName = NativeHelpers.CanonicalNameFromDistinguishedName(base.InternalADObjectId.DistinguishedName); this.canonicalName = this.canonicalName.TrimEnd(new char[] { '/' }); } return(this.canonicalName); }
internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { IEnumerable <T> enumerable = Enumerable.Empty <T>(); if (this.ShouldIncludeOutOfBoxCollections && VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && base.InternalADObjectId == null) { bool flag = false; bool flag2 = OrganizationId.ForestWideOrgId.Equals(session.SessionSettings.CurrentOrganizationId); if (flag2 && this.IsHierarchical && this.IsHierarchyValid) { ClassificationRuleCollectionIdParameter classificationRuleCollectionIdParameter = new ClassificationRuleCollectionIdParameter(this.FriendlyName); enumerable = classificationRuleCollectionIdParameter.GetObjects <T>(rootId, (IConfigDataProvider)session, optionalData, out notFoundReason); flag = true; } else if (!flag2 && !this.IsHierarchical) { ITopologyConfigurationSession session2 = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 431, "GetObjects", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\ClassificationDefinitions\\ClassificationRuleCollectionIdParameter.cs"); enumerable = base.GetObjects <T>(ClassificationDefinitionUtils.GetClassificationRuleCollectionContainerId(session2), session2, null, out notFoundReason); flag = true; } if (flag) { if (optionalData == null) { optionalData = new OptionalIdentityData(); } List <T> list = enumerable.ToList <T>(); QueryFilter queryFilter = ClassificationRuleCollectionIdParameter.CreateExcludeFilter <T>(list); if (queryFilter != null) { optionalData.AdditionalFilter = ((optionalData.AdditionalFilter == null) ? queryFilter : QueryFilter.AndTogether(new QueryFilter[] { optionalData.AdditionalFilter, queryFilter })); } enumerable = list; } } return(enumerable.Concat(base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason))); }
// Token: 0x06000977 RID: 2423 RVA: 0x000208F0 File Offset: 0x0001EAF0 internal override IEnumerable <T> GetObjects <T>(ADObjectId rootId, IDirectorySession session, IDirectorySession subTreeSession, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) { TaskLogger.LogEnter(); IEnumerable <T> enumerable = null; notFoundReason = null; if (typeof(T) != typeof(DetailsTemplate)) { throw new ArgumentException(Strings.ErrorInvalidType(typeof(T).Name), "type"); } try { if (base.InternalADObjectId != null) { return(base.GetADObjectIdObjects <T>(base.InternalADObjectId, rootId, subTreeSession, optionalData)); } ADObjectId childId = ((IConfigurationSession)session).GetOrgContainerId().GetChildId("Addressing").GetChildId("Display-Templates"); QueryFilter filter = null; if (this.language != null) { childId = childId.GetChildId(this.language.LCID.ToString("X")); } if (this.type != null) { filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, this.type); } enumerable = base.PerformPrimarySearch <T>(filter, childId, session, true, optionalData); EnumerableWrapper <T> wrapper = EnumerableWrapper <T> .GetWrapper(enumerable); if (wrapper.HasElements()) { return(wrapper); } enumerable = base.GetObjects <T>(rootId, session, subTreeSession, optionalData, out notFoundReason); } finally { TaskLogger.LogExit(); } return(enumerable); }
public void DeleteTree(ADConfigurationObject instanceToDelete, TreeDeleteNotFinishedHandler handler) { if (instanceToDelete == null) { throw new ArgumentNullException("instanceToDelete"); } ADConfigurationSession adconfigurationSession = this; IDirectorySession session = instanceToDelete.Session; try { for (;;) { try { adconfigurationSession.Delete(instanceToDelete, true); } catch (ADTreeDeleteNotFinishedException ex) { ExTraceGlobals.ADTopologyTracer.TraceWarning <string, string>((long)this.GetHashCode(), "ADTreeDeleteNotFinishedException is caught while deleting the whole tree '{0}': {1}", instanceToDelete.Identity.ToString(), ex.Message); if (handler != null) { handler(ex); } if (string.IsNullOrEmpty(adconfigurationSession.DomainController)) { adconfigurationSession = (ADConfigurationSession)this.Clone(); adconfigurationSession.DomainController = ex.Server; instanceToDelete.m_Session = null; } continue; } break; } } finally { instanceToDelete.m_Session = session; } }
// Token: 0x060006F2 RID: 1778 RVA: 0x00025440 File Offset: 0x00023640 private ADVlvPagedReader(ADObjectId addressBook, IDirectorySession session, ADObjectId rootId, QueryScope scope, QueryFilter filter, SortBy sortBy, bool includeBookmarkObject, bool searchForward, int pageSize, int offset, string target, IEnumerable <PropertyDefinition> properties) : base(session, rootId, scope, filter, sortBy, pageSize, properties, false) { if (addressBook != null) { filter = new AndFilter(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.AddressListMembership, addressBook), new ExistsFilter(ADRecipientSchema.DisplayName) }); base.LdapFilter = LdapFilterBuilder.LdapFilterFromQueryFilter(filter, false, base.Session.SessionSettings.PartitionSoftLinkMode, base.Session.SessionSettings.IsTenantScoped); base.UseNullRoot = true; } this.searchForward = searchForward; this.includeBookmarkObject = includeBookmarkObject; this.offSet = offset; if (this.offSet == 2147483647) { this.offSet = 0; } this.vlvRequestControl = new VlvRequestControl(0, 0, target); base.DirectoryControls.Add(this.vlvRequestControl); }
public DirectoryEventStoreSession(IDirectorySession openSession) { _openSession = openSession; }