Ejemplo n.º 1
0
        protected override void InternalBeginProcessing()
        {
            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            if (base.ManagedBy != null && base.ManagedBy.IsChangesOnlyCopy)
            {
                MultiValuedProperty <GeneralRecipientIdParameter> managedBy = base.ManagedBy;
                base.ManagedBy = new MultiValuedProperty <GeneralRecipientIdParameter>();
                base.ManagedBy.CopyChangesFrom(managedBy);
            }
            ADObjectId adobjectId = null;

            base.TryGetExecutingUserId(out adobjectId);
            if (!base.Fields.IsModified(ADGroupSchema.ManagedBy) && adobjectId != null)
            {
                if (!base.CurrentOrganizationId.Equals(base.ExecutingUserOrganizationId))
                {
                    base.WriteError(new RecipientTaskException(Strings.ErrorManagedByMustBeSpecifiedWIthOrganization), ExchangeErrorCategory.Client, null);
                }
                else
                {
                    base.ManagedBy = new MultiValuedProperty <GeneralRecipientIdParameter>(adobjectId);
                }
                MailboxTaskHelper.CheckAndResolveManagedBy <ADGroup>(this, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), ExchangeErrorCategory.ServerOperation, (base.ManagedBy == null) ? null : base.ManagedBy.ToArray(), out this.managedByRecipients);
            }
            else
            {
                MailboxTaskHelper.CheckAndResolveManagedBy <ADGroup>(this, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), ExchangeErrorCategory.Client, (base.ManagedBy == null) ? null : base.ManagedBy.ToArray(), out this.managedByRecipients);
            }
            TaskLogger.LogExit();
        }
Ejemplo n.º 2
0
        protected override void InternalBeginProcessing()
        {
            bool flag = false;

            TaskLogger.LogEnter();
            base.InternalBeginProcessing();
            if (this.ValidationOrganization != null && !string.Equals(this.ValidationOrganization, base.CurrentOrganizationId.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                base.ThrowTerminatingError(new ValidationOrgCurrentOrgNotMatchException(this.ValidationOrganization, base.CurrentOrganizationId.ToString()), ExchangeErrorCategory.Client, null);
            }
            if ("crossforest" == base.ParameterSetName)
            {
                try
                {
                    NetworkCredential userForestCredential = (this.LinkedCredential == null) ? null : this.LinkedCredential.GetNetworkCredential();
                    this.linkedGroupSid = MailboxTaskHelper.GetSidFromAnotherForest <ADGroup>(this.LinkedForeignGroup, this.LinkedDomainController, userForestCredential, base.GlobalConfigSession, new MailboxTaskHelper.GetUniqueObject(base.GetDataObject <ADGroup>), new Task.ErrorLoggerDelegate(base.ThrowTerminatingError), new MailboxTaskHelper.OneStringErrorDelegate(Strings.ErrorLinkedGroupInTheCurrentForest), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotFoundOnGlobalCatalog), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotFoundOnDomainController), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotUniqueOnGlobalCatalog), new MailboxTaskHelper.TwoStringErrorDelegate(Strings.ErrorGroupNotUniqueOnDomainController), new MailboxTaskHelper.OneStringErrorDelegate(Strings.ErrorVerifyLinkedGroupForest));
                }
                catch (PSArgumentException exception)
                {
                    base.ThrowTerminatingError(exception, ErrorCategory.InvalidArgument, this.LinkedCredential);
                }
            }
            if (!base.Fields.IsModified(ADGroupSchema.ManagedBy) && base.CurrentOrganizationId.Equals(base.ExecutingUserOrganizationId))
            {
                List <SecurityPrincipalIdParameter> list = new List <SecurityPrincipalIdParameter>(2);
                flag = true;
                bool useGlobalCatalog     = base.TenantGlobalCatalogSession.UseGlobalCatalog;
                bool useConfigNC          = base.TenantGlobalCatalogSession.UseConfigNC;
                bool skipRangedAttributes = base.TenantGlobalCatalogSession.SkipRangedAttributes;
                try
                {
                    base.TenantGlobalCatalogSession.UseGlobalCatalog     = true;
                    base.TenantGlobalCatalogSession.UseConfigNC          = false;
                    base.TenantGlobalCatalogSession.SkipRangedAttributes = true;
                    ADGroup adgroup = base.TenantGlobalCatalogSession.ResolveWellKnownGuid <ADGroup>(RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid, OrganizationId.ForestWideOrgId.Equals(base.CurrentOrganizationId) ? this.ConfigurationSession.ConfigurationNamingContext : base.TenantGlobalCatalogSession.SessionSettings.CurrentOrganizationId.ConfigurationUnit);
                    if (adgroup == null)
                    {
                        base.ThrowTerminatingError(new ManagementObjectNotFoundException(DirectoryStrings.ExceptionADTopologyCannotFindWellKnownExchangeGroup), (ErrorCategory)1001, RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid);
                    }
                    list.Add(new SecurityPrincipalIdParameter(adgroup.DistinguishedName));
                }
                finally
                {
                    base.TenantGlobalCatalogSession.UseGlobalCatalog     = useGlobalCatalog;
                    base.TenantGlobalCatalogSession.UseConfigNC          = useConfigNC;
                    base.TenantGlobalCatalogSession.SkipRangedAttributes = skipRangedAttributes;
                }
                ADObjectId adObjectId;
                if (base.TryGetExecutingUserId(out adObjectId))
                {
                    list.Add(new SecurityPrincipalIdParameter(adObjectId));
                }
                this.ManagedBy = new MultiValuedProperty <SecurityPrincipalIdParameter>(list);
            }
            if (this.ManagedBy == null)
            {
                base.WriteError(new RecipientTaskException(Strings.ErrorManagedByCannotBeEmpty), (ErrorCategory)1000, null);
            }
            if (!flag || !DatacenterRegistry.IsForefrontForOffice())
            {
                MailboxTaskHelper.CheckAndResolveManagedBy <ADGroup>(this, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADRecipient>), ExchangeErrorCategory.Client, this.ManagedBy.ToArray(), out this.managedByRecipients);
            }
            TaskLogger.LogExit();
        }