Beispiel #1
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (!this.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            IConfigurationSession configurationSession = null;

            base.InternalProcessRecord();
            if (this.WellKnownObjectGuid != Guid.Empty || this.roleAssignments != null)
            {
                configurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, false, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 676, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RBAC\\RoleGroup\\NewRoleGroup.cs");
                configurationSession.LinkResolutionServer = this.DataObject.OriginatingServer;
            }
            if (this.WellKnownObjectGuid != Guid.Empty)
            {
                try
                {
                    RoleGroupCommon.StampWellKnownObjectGuid(configurationSession, this.DataObject.OrganizationId, this.DataObject.DistinguishedName, this.WellKnownObjectGuid);
                }
                catch (Exception)
                {
                    this.DataObject.ExternalDirectoryObjectId = null;
                    base.DataSession.Save(this.DataObject);
                    base.DataSession.Delete(this.DataObject);
                    throw;
                }
            }
            if (this.roleAssignments != null)
            {
                List <ExchangeRoleAssignment> list = new List <ExchangeRoleAssignment>();
                string id = string.Empty;
                try
                {
                    foreach (ExchangeRoleAssignment exchangeRoleAssignment in this.roleAssignments)
                    {
                        exchangeRoleAssignment.User = this.DataObject.Id;
                        id = exchangeRoleAssignment.Id.Name;
                        configurationSession.Save(exchangeRoleAssignment);
                        list.Add(exchangeRoleAssignment);
                    }
                }
                catch (Exception)
                {
                    this.WriteWarning(Strings.WarningCouldNotCreateRoleAssignment(id, this.Name));
                    foreach (ExchangeRoleAssignment exchangeRoleAssignment2 in list)
                    {
                        base.WriteVerbose(Strings.VerboseRemovingRoleAssignment(exchangeRoleAssignment2.Id.ToString()));
                        configurationSession.Delete(exchangeRoleAssignment2);
                        base.WriteVerbose(Strings.VerboseRemovedRoleAssignment(exchangeRoleAssignment2.Id.ToString()));
                    }
                    base.WriteVerbose(Strings.VerboseRemovingRoleGroup(this.DataObject.Id.ToString()));
                    base.DataSession.Delete(this.DataObject);
                    throw;
                }
            }
            TaskLogger.LogExit();
        }
Beispiel #2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (this.updateOtherDefaultPolicies)
     {
         if (!base.ShouldContinue(Strings.ConfirmationMessageSwitchMailboxPolicy("OWAMailboxPolicy", this.Identity.ToString())))
         {
             return;
         }
         try
         {
             DefaultMailboxPolicyUtility <OwaMailboxPolicy> .ClearDefaultPolicies(base.DataSession as IConfigurationSession, this.otherDefaultPolicies);
         }
         catch (DataSourceTransientException exception)
         {
             base.WriteError(exception, ErrorCategory.ReadError, null);
         }
     }
     if (base.Fields.IsChanged("DisableFacebook") && this.DisableFacebook)
     {
         this.DataObject.FacebookEnabled = false;
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (!this.Force && SharedConfiguration.IsSharedConfiguration(base.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(base.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            ADPagedReader <ADRawEntry> adpagedReader = this.ConfigurationSession.FindPagedADRawEntryWithDefaultFilters <ExchangeRole>(base.DataObject.Id, this.Recurse ? QueryScope.SubTree : QueryScope.Base, new ExistsFilter(ExchangeRoleSchema.RoleAssignments), null, 0, new PropertyDefinition[]
            {
                ADObjectSchema.Id,
                ExchangeRoleSchema.RoleAssignments
            });

            foreach (ADRawEntry adrawEntry in adpagedReader)
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorCannotDeleteRoleWithAssignment(adrawEntry.Id.ToString())), ErrorCategory.InvalidOperation, base.DataObject.Id);
            }
            if (this.Recurse)
            {
                ((IConfigurationSession)base.DataSession).DeleteTree(base.DataObject, new TreeDeleteNotFinishedHandler(this.ReportDeleteTreeProgress));
            }
            else
            {
                base.InternalProcessRecord();
            }
            TaskLogger.LogExit();
        }
Beispiel #4
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.DataObject != null && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (this.updateExistingDefaultPolicies)
     {
         if (!base.ShouldContinue(Strings.ConfirmationMessageSwitchMailboxPolicy("RetentionPolicy", this.DataObject.Name)))
         {
             return;
         }
         try
         {
             RetentionPolicyUtility.ClearDefaultPolicies(base.DataSession as IConfigurationSession, this.existingDefaultPolicies, this.IsDefaultArbitrationMailbox);
         }
         catch (DataSourceTransientException exception)
         {
             base.WriteError(exception, ErrorCategory.ReadError, null);
         }
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
Beispiel #5
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            if (this.DataObject.IsConflicted())
            {
                base.WriteError(new OperationNotAllowedException(Strings.ConflictedPolicyUpdateNotAllowed), ErrorCategory.InvalidOperation, this.DataObject.Identity);
            }
            MalwareFilterPolicy malwareFilterPolicy = null;

            if (this.MakeDefault && !this.DataObject.IsDefault)
            {
                this.DataObject.IsDefault = true;
                malwareFilterPolicy       = this.GetDefaultMalwareFilterPolicy();
                if (malwareFilterPolicy != null && malwareFilterPolicy.IsDefault)
                {
                    malwareFilterPolicy.IsDefault = false;
                    base.DataSession.Save(malwareFilterPolicy);
                }
            }
            else if (base.Fields.Contains("MakeDefault") && !this.MakeDefault && this.DataObject.IsDefault)
            {
                MalwareFilterPolicy[] allDefaultMalwareFilterPolicies = this.GetAllDefaultMalwareFilterPolicies();
                if (allDefaultMalwareFilterPolicies.Length > 1 && !this.DataObject.IsConflicted())
                {
                    foreach (MalwareFilterPolicy malwareFilterPolicy2 in allDefaultMalwareFilterPolicies)
                    {
                        if (malwareFilterPolicy2.IsConflicted())
                        {
                            malwareFilterPolicy2.IsDefault = false;
                            base.DataSession.Save(malwareFilterPolicy2);
                        }
                    }
                }
                else
                {
                    base.WriteError(new OperationNotAllowedException(Strings.OperationNotAllowed), ErrorCategory.InvalidOperation, this.MakeDefault);
                }
            }
            try
            {
                base.InternalProcessRecord();
                malwareFilterPolicy = null;
            }
            finally
            {
                if (malwareFilterPolicy != null)
                {
                    malwareFilterPolicy.IsDefault = true;
                    base.DataSession.Save(malwareFilterPolicy);
                }
            }
            TaskLogger.LogExit();
        }
Beispiel #6
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (!this.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
Beispiel #7
0
        // Token: 0x06001113 RID: 4371 RVA: 0x000635C4 File Offset: 0x000617C4
        protected override Dictionary <Guid, OrganizationId> GetTenantsNeedingGrammars(List <ADUser> systemMailboxes)
        {
            UMTracer.DebugTrace("DatacenterUMGrammarTenantCache.GetTenantsNeedingGrammars", new object[0]);
            Dictionary <Guid, OrganizationId> dictionary = new Dictionary <Guid, OrganizationId>();

            foreach (ADUser aduser in systemMailboxes)
            {
                if (aduser.OrganizationId != null && aduser.OrganizationId.ConfigurationUnit != null && aduser.OrganizationId.OrganizationalUnit != null)
                {
                    if (SharedConfiguration.IsSharedConfiguration(aduser.OrganizationId))
                    {
                        UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because it is a shared configuration", new object[]
                        {
                            aduser.ExchangeGuid,
                            aduser.OrganizationId
                        });
                    }
                    else
                    {
                        IADRecipientLookup iadrecipientLookup = ADRecipientLookupFactory.CreateFromOrganizationId(aduser.OrganizationId, null);
                        if (iadrecipientLookup.TenantSizeExceedsThreshold(GrammarRecipientHelper.GetUserFilter(), 10))
                        {
                            if (!dictionary.ContainsKey(aduser.ExchangeGuid))
                            {
                                UMTracer.DebugTrace("Adding Mbox='{0}', Organization='{1}'", new object[]
                                {
                                    aduser.ExchangeGuid,
                                    aduser.OrganizationId
                                });
                                dictionary.Add(aduser.ExchangeGuid, aduser.OrganizationId);
                            }
                            else
                            {
                                UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because Mbox is already included. ", new object[]
                                {
                                    aduser.ExchangeGuid,
                                    aduser.OrganizationId
                                });
                            }
                        }
                        else
                        {
                            UMTracer.DebugTrace("Skipping Mbox='{0}', Organization='{1}' because it does not exceed size threshold", new object[]
                            {
                                aduser.ExchangeGuid,
                                aduser.OrganizationId
                            });
                        }
                    }
                }
            }
            return(dictionary);
        }
Beispiel #8
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(base.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(base.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     FfoDualWriter.DeleteFromFfo <HostedConnectionFilterPolicy>(this, base.DataObject);
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     this.dualWriter.Save <HostedOutboundSpamFilterPolicy>(this, this.DataObject);
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.CreateParentContainerIfNeeded(this.DataObject);
     base.InternalProcessRecord();
     FfoDualWriter.SaveToFfo <HostedContentFilterPolicy>(this, this.DataObject, null);
     TaskLogger.LogExit();
 }
        protected override void InternalProcessRecord()
        {
            if (!this.Force && SharedConfiguration.IsSharedConfiguration(base.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(base.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            if (this.roleAssignmentResults.Length != 0)
            {
                ((IRecipientSession)base.DataSession).VerifyIsWithinScopes(base.DataObject, true);
            }
            bool flag = true;

            foreach (Result <ExchangeRoleAssignment> result in this.roleAssignmentResults)
            {
                string id = result.Data.Id.ToString();
                try
                {
                    base.WriteVerbose(Strings.VerboseRemovingRoleAssignment(id));
                    result.Data.Session.Delete(result.Data);
                    base.WriteVerbose(Strings.VerboseRemovedRoleAssignment(id));
                }
                catch (Exception ex)
                {
                    flag = false;
                    if (!base.IsKnownException(ex))
                    {
                        throw;
                    }
                    this.WriteWarning(Strings.WarningCouldNotRemoveRoleAssignment(id, ex.Message));
                }
            }
            if (!flag)
            {
                base.WriteError(new TaskException(Strings.ErrorCouldNotRemoveRoleAssignments(base.DataObject.Id.ToString())), ExchangeErrorCategory.ServerOperation, base.DataObject);
            }
            if (this.RemoveWellKnownObjectGuid)
            {
                ExchangeConfigurationUnit exchangeConfigurationUnit = this.writableConfigSession.Read <ExchangeConfigurationUnit>(base.DataObject.OrganizationId.ConfigurationUnit);
                foreach (DNWithBinary dnwithBinary in exchangeConfigurationUnit.OtherWellKnownObjects)
                {
                    if (dnwithBinary.DistinguishedName.Equals(base.DataObject.DistinguishedName, StringComparison.OrdinalIgnoreCase))
                    {
                        exchangeConfigurationUnit.OtherWellKnownObjects.Remove(dnwithBinary);
                        this.writableConfigSession.Save(exchangeConfigurationUnit);
                        break;
                    }
                }
            }
            base.InternalProcessRecord();
        }
Beispiel #12
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(base.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(base.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (base.DataObject.IsDefault)
     {
         base.WriteError(new CannotRemoveDefaultSiteMailboxProvisioningPolicyException(), ErrorCategory.InvalidOperation, this.Identity);
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (base.DataSession.Read <Container>(this.DataObject.Id.Parent) == null)
     {
         Container container = new Container();
         container.SetId(this.DataObject.Id.Parent);
         base.DataSession.Save(container);
     }
     base.InternalProcessRecord();
 }
Beispiel #14
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (base.DataObject != null && SharedConfiguration.IsSharedConfiguration(base.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(base.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.DataObject.GetELCContentSettings().ForEach(delegate(ElcContentSettings x)
     {
         base.DataSession.Delete(x);
     });
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
Beispiel #15
0
 protected override void InternalProcessRecord()
 {
     if (this.DataObject.IsChanged(IRMConfigurationSchema.InternalLicensingEnabled) && !this.DataObject.InternalLicensingEnabled && !this.Force && !base.ShouldContinue(Strings.ConfirmationOnDisablingInternalLicensing))
     {
         return;
     }
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         return;
     }
     if (this.DataObject.InternalLicensingEnabled && this.DataObject.IsChanged(IRMConfigurationSchema.TransportDecryptionMandatory) && this.DataObject.TransportDecryptionSetting == TransportDecryptionSetting.Mandatory && !this.datacenter)
     {
         this.WriteWarning(Strings.WarningTransportDecryptionMandatoryRequiresSuperUser);
     }
     base.InternalProcessRecord();
 }
Beispiel #16
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (!this.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     if (this.WellKnownObjectGuid != Guid.Empty)
     {
         IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(null, false, ConsistencyMode.PartiallyConsistent, base.SessionSettings, 424, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RBAC\\RoleGroup\\SetRoleGroup.cs");
         RoleGroupCommon.StampWellKnownObjectGuid(tenantOrTopologyConfigurationSession, this.DataObject.OrganizationId, this.DataObject.DistinguishedName, this.WellKnownObjectGuid);
     }
     TaskLogger.LogExit();
 }
Beispiel #17
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter(new object[]
     {
         this.DataObject
     });
     if (this.Exclusive && !this.Force && !base.ShouldContinue(Strings.ConfirmCreatingExclusiveScope(this.DataObject.Identity.ToString())))
     {
         TaskLogger.LogExit();
         return;
     }
     if (!this.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     if (this.Default)
     {
         SetSharingPolicy.SetDefaultSharingPolicy(this.ConfigurationSession, this.DataObject.OrganizationId, this.DataObject.Id);
     }
     if (this.DataObject.IsAllowedForAnyAnonymousFeature() && !SetSharingPolicy.IsDatacenter)
     {
         this.WriteWarning(Strings.AnonymousSharingEnabledWarning);
     }
     TaskLogger.LogExit();
 }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            HostedContentFilterPolicy hostedContentFilterPolicy = null;

            if (this.MakeDefault && !this.DataObject.IsDefault)
            {
                this.DataObject.IsDefault = true;
                hostedContentFilterPolicy = ((ITenantConfigurationSession)base.DataSession).GetDefaultFilteringConfiguration <HostedContentFilterPolicy>();
                if (hostedContentFilterPolicy != null && hostedContentFilterPolicy.IsDefault)
                {
                    hostedContentFilterPolicy.IsDefault = false;
                    base.DataSession.Save(hostedContentFilterPolicy);
                    FfoDualWriter.SaveToFfo <HostedContentFilterPolicy>(this, hostedContentFilterPolicy, null);
                }
            }
            else if (base.Fields.Contains("MakeDefault") && !this.MakeDefault && this.DataObject.IsDefault)
            {
                base.WriteError(new OperationNotAllowedException(Strings.OperationNotAllowed), ErrorCategory.InvalidOperation, this.MakeDefault);
            }
            try
            {
                base.InternalProcessRecord();
                FfoDualWriter.SaveToFfo <HostedContentFilterPolicy>(this, this.DataObject, null);
                hostedContentFilterPolicy = null;
            }
            finally
            {
                if (hostedContentFilterPolicy != null)
                {
                    hostedContentFilterPolicy.IsDefault = true;
                    base.DataSession.Save(hostedContentFilterPolicy);
                    FfoDualWriter.SaveToFfo <HostedContentFilterPolicy>(this, hostedContentFilterPolicy, null);
                }
            }
            TaskLogger.LogExit();
        }
Beispiel #20
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.DataObject != null && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (this.Mailbox != null)
     {
         ExchangePrincipal exchangePrincipal = this.ProcessPrimaryMailbox();
         IRecipientSession recipientSession;
         ADUser            user = StoreRetentionPolicyTagHelper.FetchRecipientFromMailboxId(base.DomainController, this.Mailbox, out recipientSession, exchangePrincipal.MailboxInfo.OrganizationId);
         if (exchangePrincipal != null && StoreRetentionPolicyTagHelper.HasOnPremArchiveMailbox(user))
         {
             this.ProcessArchiveMailbox();
         }
     }
     else
     {
         bool flag = this.DataObject.IsChanged(ADObjectSchema.Name);
         if (this.DataObject.IsChanged(RetentionPolicyTagSchema.RetentionId) && !this.Force && !base.ShouldContinue(Strings.WarningRetentionTagIdChange(this.DataObject.Identity.ToString())))
         {
             return;
         }
         base.InternalProcessRecord();
         if (this.contentSettingsObject.ObjectState == ObjectState.Changed)
         {
             if (flag)
             {
                 ElcContentSettings elcContentSettings = this.DataObject.GetELCContentSettings().FirstOrDefault <ElcContentSettings>();
                 elcContentSettings.CopyChangesFrom(this.contentSettingsObject);
                 this.contentSettingsObject = elcContentSettings;
             }
             base.DataSession.Save(this.contentSettingsObject);
         }
     }
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (this.updateOtherDefaultPolicies)
     {
         try
         {
             DefaultMailboxPolicyUtility <TeamMailboxProvisioningPolicy> .ClearDefaultPolicies(base.DataSession as IConfigurationSession, this.otherDefaultPolicies);
         }
         catch (DataSourceTransientException exception)
         {
             base.WriteError(exception, ErrorCategory.ReadError, null);
         }
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
Beispiel #22
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter(new object[]
            {
                this.DataObject
            });
            base.Validate(this.DataObject);
            if (base.HasErrors)
            {
                return;
            }
            if (!base.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            this.DataObject.CheckWritable();
            string key = this.DataObject.Guid.ToString();

            if (this.roleAndSessionCache.ContainsKey(key))
            {
                AddRemoveManagementRoleEntryActionBase.RoleAndSession roleAndSession = this.roleAndSessionCache[key];
                this.InternalAddRemoveRoleEntry(roleAndSession.Role.RoleEntries);
                base.Validate(roleAndSession.Role);
                if (base.HasErrors)
                {
                    return;
                }
            }
            else
            {
                this.roleAndSessionCache[key] = new AddRemoveManagementRoleEntryActionBase.RoleAndSession(this.DataObject, base.DataSession, base.ParentRole);
            }
            this.roleAndSessionCache[key].PipelinedElements.Add(new AddRemoveManagementRoleEntryActionBase.PipelinedElement(base.CurrentObjectIndex, this.GetRoleEntryString()));
            TaskLogger.LogExit();
        }
Beispiel #23
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (!this.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
            {
                TaskLogger.LogExit();
                return;
            }
            if (base.Fields.IsModified(RbacCommonParameters.ParameterEnabled))
            {
                this.DataObject.Enabled = this.Enabled;
            }
            ExchangeRole exchangeRole = (ExchangeRole)base.GetDataObject <ExchangeRole>(new RoleIdParameter(this.DataObject.Role), this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorRoleNotFound(this.DataObject.Role.ToString())), new LocalizedString?(Strings.ErrorRoleNotUnique(this.DataObject.Role.ToString())));

            if (base.Fields.IsModified(RbacCommonParameters.ParameterRecipientRelativeWriteScope))
            {
                this.DataObject.RecipientWriteScope       = this.RecipientRelativeWriteScope;
                this.DataObject.CustomRecipientWriteScope = null;
            }
            else
            {
                if (base.Fields.IsModified(RbacCommonParameters.ParameterRecipientOrganizationalUnitScope))
                {
                    this.DataObject.RecipientWriteScope = RecipientWriteScopeType.OU;
                    bool useConfigNC      = this.ConfigurationSession.UseConfigNC;
                    bool useGlobalCatalog = this.ConfigurationSession.UseGlobalCatalog;
                    try
                    {
                        this.ConfigurationSession.UseConfigNC      = false;
                        this.ConfigurationSession.UseGlobalCatalog = true;
                        ExchangeOrganizationalUnit exchangeOrganizationalUnit = (ExchangeOrganizationalUnit)base.GetDataObject <ExchangeOrganizationalUnit>(this.RecipientOrganizationalUnitScope, this.ConfigurationSession, this.DataObject.OrganizationalUnitRoot, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.RecipientOrganizationalUnitScope.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.RecipientOrganizationalUnitScope.ToString())));
                        this.DataObject.CustomRecipientWriteScope = exchangeOrganizationalUnit.Id;
                        goto IL_321;
                    }
                    finally
                    {
                        this.ConfigurationSession.UseConfigNC      = useConfigNC;
                        this.ConfigurationSession.UseGlobalCatalog = useGlobalCatalog;
                    }
                }
                if (base.Fields.IsModified(RbacCommonParameters.ParameterCustomRecipientWriteScope))
                {
                    if (this.CustomRecipientWriteScope == null)
                    {
                        this.DataObject.CustomRecipientWriteScope = null;
                        this.DataObject.RecipientWriteScope       = (RecipientWriteScopeType)exchangeRole.ImplicitRecipientWriteScope;
                    }
                    else
                    {
                        ManagementScope andValidateDomainScope = RoleHelper.GetAndValidateDomainScope(this.CustomRecipientWriteScope, this.ConfigurationSession, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ManagementScope>), this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
                        if (andValidateDomainScope.Exclusive)
                        {
                            base.WriteError(new ArgumentException(Strings.ErrorScopeExclusive(andValidateDomainScope.Id.ToString(), RbacCommonParameters.ParameterCustomRecipientWriteScope)), ErrorCategory.InvalidArgument, null);
                        }
                        this.DataObject.CustomRecipientWriteScope = andValidateDomainScope.Id;
                        this.DataObject.RecipientWriteScope       = RecipientWriteScopeType.CustomRecipientScope;
                    }
                }
                else if (base.Fields.IsModified("ExclusiveRecipientWriteScope"))
                {
                    ManagementScope andValidateDomainScope2 = RoleHelper.GetAndValidateDomainScope(this.ExclusiveRecipientWriteScope, this.ConfigurationSession, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ManagementScope>), this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
                    if (!andValidateDomainScope2.Exclusive)
                    {
                        base.WriteError(new ArgumentException(Strings.ErrorScopeNotExclusive(andValidateDomainScope2.Id.ToString(), "ExclusiveRecipientWriteScope")), ErrorCategory.InvalidArgument, null);
                    }
                    this.DataObject.CustomRecipientWriteScope = andValidateDomainScope2.Id;
                    this.DataObject.RecipientWriteScope       = RecipientWriteScopeType.ExclusiveRecipientScope;
                }
            }
IL_321:
            RoleHelper.VerifyNoScopeForUnScopedRole(base.Fields, exchangeRole, new Task.TaskErrorLoggingDelegate(base.WriteError));
            if (exchangeRole.ImplicitRecipientWriteScope != (ScopeType)this.DataObject.RecipientWriteScope && !RbacScope.IsScopeTypeSmaller((ScopeType)this.DataObject.RecipientWriteScope, exchangeRole.ImplicitRecipientWriteScope))
            {
                this.WriteWarning(Strings.WriteScopeGreaterThanRoleScope(this.DataObject.RecipientWriteScope.ToString(), exchangeRole.Name, exchangeRole.ImplicitRecipientWriteScope.ToString()));
                this.DataObject.CustomRecipientWriteScope = null;
                this.DataObject.RecipientWriteScope       = (RecipientWriteScopeType)exchangeRole.ImplicitRecipientWriteScope;
            }
            if (base.Fields.IsModified(RbacCommonParameters.ParameterCustomConfigWriteScope))
            {
                if (this.CustomConfigWriteScope == null)
                {
                    this.DataObject.ConfigWriteScope       = (ConfigWriteScopeType)exchangeRole.ImplicitConfigWriteScope;
                    this.DataObject.CustomConfigWriteScope = null;
                }
                else
                {
                    this.DataObject.ConfigWriteScope = ConfigWriteScopeType.CustomConfigScope;
                    ManagementScope andValidateConfigScope = RoleHelper.GetAndValidateConfigScope(this.CustomConfigWriteScope, this.ConfigurationSession, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ManagementScope>), this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
                    if (andValidateConfigScope.Exclusive)
                    {
                        base.WriteError(new ArgumentException(Strings.ErrorScopeExclusive(andValidateConfigScope.Id.ToString(), RbacCommonParameters.ParameterCustomConfigWriteScope)), ErrorCategory.InvalidArgument, null);
                    }
                    this.DataObject.CustomConfigWriteScope = andValidateConfigScope.Id;
                    this.DataObject.ConfigWriteScope       = ((andValidateConfigScope.ScopeRestrictionType == ScopeRestrictionType.PartnerDelegatedTenantScope) ? ConfigWriteScopeType.PartnerDelegatedTenantScope : ConfigWriteScopeType.CustomConfigScope);
                }
            }
            else if (base.Fields.IsModified("ExclusiveConfigWriteScope"))
            {
                ManagementScope andValidateConfigScope2 = RoleHelper.GetAndValidateConfigScope(this.ExclusiveConfigWriteScope, this.ConfigurationSession, new DataAccessHelper.GetDataObjectDelegate(base.GetDataObject <ManagementScope>), this.DataObject, new Task.TaskErrorLoggingDelegate(base.WriteError));
                if (!andValidateConfigScope2.Exclusive)
                {
                    base.WriteError(new ArgumentException(Strings.ErrorScopeNotExclusive(andValidateConfigScope2.Id.ToString(), "ExclusiveConfigWriteScope")), ErrorCategory.InvalidArgument, null);
                }
                this.DataObject.CustomConfigWriteScope = andValidateConfigScope2.Id;
                this.DataObject.ConfigWriteScope       = ConfigWriteScopeType.ExclusiveConfigScope;
            }
            if (exchangeRole.ImplicitConfigWriteScope != (ScopeType)this.DataObject.ConfigWriteScope && !RbacScope.IsScopeTypeSmaller((ScopeType)this.DataObject.ConfigWriteScope, exchangeRole.ImplicitConfigWriteScope))
            {
                this.WriteWarning(Strings.WriteScopeGreaterThanRoleScope(this.DataObject.CustomConfigWriteScope.ToString(), exchangeRole.Name, exchangeRole.ImplicitConfigWriteScope.ToString()));
                this.DataObject.CustomConfigWriteScope = null;
                this.DataObject.ConfigWriteScope       = (ConfigWriteScopeType)exchangeRole.ImplicitConfigWriteScope;
            }
            RoleHelper.HierarchyRoleAssignmentChecking(this.DataObject, base.ExchangeRunspaceConfig, this.ConfigurationSession, base.ExecutingUserOrganizationId, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), !this.Enabled);
            base.InternalProcessRecord();
            TaskLogger.LogExit();
        }
Beispiel #24
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (!this.Force && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     base.InternalProcessRecord();
     if (this.UnScopedTopLevel)
     {
         try
         {
             if (base.ExecutingUserOrganizationId.Equals(this.DataObject.OrganizationId))
             {
                 ADObjectId       id;
                 RoleAssigneeType roleAssigneeType;
                 if (base.TryGetExecutingUserId(out id))
                 {
                     roleAssigneeType = RoleAssigneeType.User;
                 }
                 else
                 {
                     roleAssigneeType = RoleAssigneeType.RoleGroup;
                     bool    useGlobalCatalog     = base.TenantGlobalCatalogSession.UseGlobalCatalog;
                     bool    useConfigNC          = base.TenantGlobalCatalogSession.UseConfigNC;
                     bool    skipRangedAttributes = base.TenantGlobalCatalogSession.SkipRangedAttributes;
                     ADGroup adgroup;
                     try
                     {
                         base.TenantGlobalCatalogSession.UseGlobalCatalog     = true;
                         base.TenantGlobalCatalogSession.UseConfigNC          = false;
                         base.TenantGlobalCatalogSession.SkipRangedAttributes = true;
                         adgroup = base.TenantGlobalCatalogSession.ResolveWellKnownGuid <ADGroup>(RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid, OrganizationId.ForestWideOrgId.Equals(base.CurrentOrganizationId) ? this.ConfigurationSession.ConfigurationNamingContext : base.TenantGlobalCatalogSession.SessionSettings.CurrentOrganizationId.ConfigurationUnit);
                     }
                     finally
                     {
                         base.TenantGlobalCatalogSession.UseGlobalCatalog     = useGlobalCatalog;
                         base.TenantGlobalCatalogSession.UseConfigNC          = useConfigNC;
                         base.TenantGlobalCatalogSession.SkipRangedAttributes = skipRangedAttributes;
                     }
                     if (adgroup != null)
                     {
                         id = adgroup.Id;
                     }
                     else
                     {
                         base.ThrowTerminatingError(new ManagementObjectNotFoundException(DirectoryStrings.ExceptionADTopologyCannotFindWellKnownExchangeGroup), (ErrorCategory)1001, RoleGroup.OrganizationManagement_InitInfo.WellKnownGuid);
                     }
                 }
                 RoleHelper.CreateRoleAssignment(this.DataObject, id, base.ExecutingUserOrganizationId, roleAssigneeType, this.DataObject.OriginatingServer, RoleAssignmentDelegationType.DelegatingOrgWide, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, base.DataSession as IConfigurationSession, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskErrorLoggingDelegate(base.WriteError));
             }
         }
         catch (Exception)
         {
             this.WriteWarning(Strings.WarningFailedToCreateAssignmentForNewRole(this.DataObject.Id.ToString()));
             base.DataSession.Delete(this.DataObject);
             throw;
         }
         if (base.ExchangeRunspaceConfig != null)
         {
             base.ExchangeRunspaceConfig.LoadRoleCmdletInfo();
         }
     }
     TaskLogger.LogExit();
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.DataObject != null && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name)))
     {
         TaskLogger.LogExit();
         return;
     }
     if (this.existingDefaultPolicyTags != null && this.existingDefaultPolicyTags.Count > 0)
     {
         RetentionPolicyTagUtility.ClearDefaultPolicyTag(base.DataSession as IConfigurationSession, this.existingDefaultPolicyTags, this.DataObject.IsDefaultAutoGroupPolicyTag ? ApprovalApplicationId.AutoGroup : ApprovalApplicationId.ModeratedRecipient);
     }
     try
     {
         if (base.ParameterSetName == "RetentionPolicy")
         {
             base.InternalProcessRecord();
         }
         else if (base.ParameterSetName == "UpgradeManagedFolder")
         {
             this.ElcFolderToUpgrade = (base.GetDataObject <ELCFolder>(this.ManagedFolderToUpgrade, base.DataSession, null, new LocalizedString?(Strings.ErrorElcFolderNotFound(this.ManagedFolderToUpgrade.ToString())), new LocalizedString?(Strings.ErrorAmbiguousElcFolderId(this.ManagedFolderToUpgrade.ToString()))) as ELCFolder);
             ElcContentSettings[] array = this.ElcFolderToUpgrade.GetELCContentSettings().ToArray <ElcContentSettings>();
             bool flag = this.DataObject.Type == ElcFolderType.All;
             if (array.Length > 0)
             {
                 this.upgradedContentSettings = this.GetUpgradedConentSettings(array, flag).ToArray <ElcContentSettings>();
                 if (this.upgradedContentSettings.Length < 1)
                 {
                     base.WriteError(new RetentionPolicyTagTaskException(Strings.ErrorCannotUpgradeManagedFolder(this.ElcFolderToUpgrade.Name)), ErrorCategory.InvalidOperation, null);
                 }
             }
             else
             {
                 this.upgradedContentSettings = new ElcContentSettings[]
                 {
                     new ElcContentSettings
                     {
                         RetentionEnabled = false,
                         MessageClass     = ElcMessageClass.AllMailboxContent
                     }
                 };
             }
             if (flag)
             {
                 Array.Sort <ElcContentSettings>(this.upgradedContentSettings, delegate(ElcContentSettings x, ElcContentSettings y)
                 {
                     if (string.Compare(x.MessageClass, y.MessageClass, true) == 0)
                     {
                         return(0);
                     }
                     if (x.MessageClass == ElcMessageClass.AllMailboxContent)
                     {
                         return(-1);
                     }
                     if (y.MessageClass == ElcMessageClass.AllMailboxContent)
                     {
                         return(1);
                     }
                     return(x.MessageClass.Split(new char[]
                     {
                         '.'
                     }).Length - y.MessageClass.Split(new char[]
                     {
                         '.'
                     }).Length);
                 });
             }
             RetentionPolicyTag    dataObject = this.DataObject;
             IConfigurationSession session    = base.DataSession as IConfigurationSession;
             for (int i = 0; i < this.upgradedContentSettings.Length; i++)
             {
                 this.contentSettingsObject = this.upgradedContentSettings[i];
                 this.InternalValidate();
                 base.InternalProcessRecord();
                 this.DataObject = new RetentionPolicyTag();
                 this.DataObject.CopyChangesFrom(dataObject);
                 base.Name = this.GetUniqueName <RetentionPolicyTag>(session, dataObject.Id.Parent, dataObject.Name, i + 1);
             }
         }
     }
     catch (DataSourceTransientException exception)
     {
         base.WriteError(exception, (ErrorCategory)1002, null);
     }
     finally
     {
         if (this.nonAtomicTagObject != null)
         {
             base.DataSession.Delete(this.nonAtomicTagObject);
         }
     }
 }