Esempio n. 1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     FfoDualWriter.SaveToFfo <DomainContentConfig>(this, this.DataObject, null);
     TaskLogger.LogExit();
 }
Esempio n. 2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     FfoDualWriter.DeleteFromFfo <TenantInboundConnector>(this, base.DataObject);
     TaskLogger.LogExit();
 }
Esempio n. 3
0
        public static void SaveToFfo <T>(Task task, T adObject, TenantSettingSyncLogType logType, string oldName = null) where T : ADObject, new()
        {
            bool flag = false;

            try
            {
                if (!DatacenterRegistry.IsForefrontForOffice() && !task.CurrentOrganizationId.Equals(OrganizationId.ForestWideOrgId) && DatacenterRegistry.IsDualWriteAllowed() && adObject != null)
                {
                    flag = true;
                    if (adObject.m_Session != null)
                    {
                        ComparisonFilter filter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, adObject.Name);
                        T t = adObject.m_Session.Find <T>(null, QueryScope.SubTree, filter, null, 0).FirstOrDefault <T>();
                        if (t != null)
                        {
                            adObject = t;
                        }
                    }
                    FfoDualWriter.FixTenantId(adObject);
                    FfoDualWriter.HandleRenaming(adObject, oldName);
                    FfoDualWriter.FfoDataProvider.Save(adObject);
                }
            }
            catch (Exception ex)
            {
                if (flag)
                {
                    FfoDualWriter.LogToFile <T>(adObject, logType, oldName);
                }
                FfoDualWriter.LogException(ex);
            }
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     base.InternalProcessRecord();
     FfoDualWriter.SaveToFfo <TenantInboundConnector>(this, this.DataObject, null);
     TaskLogger.LogExit();
 }
        protected override void InternalProcessRecord()
        {
            HostedContentFilterRule hostedContentFilterRule = new HostedContentFilterRule(null, base.Name, base.Priority, base.Enabled ? RuleState.Enabled : RuleState.Disabled, base.Comments, base.Conditions, base.Exceptions, new HostedContentFilterPolicyIdParameter(this.policyObject.Name));

            if (this.policyObject.EnableEndUserSpamNotifications && !hostedContentFilterRule.IsEsnCompatible)
            {
                base.WriteError(new OperationNotAllowedException(Strings.ErrorCannotScopeEsnPolicy(this.policyObject.Name)), ErrorCategory.InvalidOperation, null);
            }
            int           priority      = base.Fields.IsModified("Priority") ? hostedContentFilterRule.Priority : -1;
            TransportRule transportRule = null;

            try
            {
                TransportRule        rule = hostedContentFilterRule.ToInternalRule();
                ADRuleStorageManager adruleStorageManager = new ADRuleStorageManager(this.ruleCollectionName, base.DataSession);
                adruleStorageManager.LoadRuleCollection();
                adruleStorageManager.NewRule(rule, this.ResolveCurrentOrganization(), ref priority, out transportRule);
                FfoDualWriter.SaveToFfo <TransportRule>(this, transportRule, TenantSettingSyncLogType.DUALSYNCTR, null);
            }
            catch (RulesValidationException exception)
            {
                base.WriteError(exception, ErrorCategory.InvalidArgument, base.Name);
            }
            catch (InvalidPriorityException exception2)
            {
                base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
            }
            catch (ParserException exception3)
            {
                base.WriteError(exception3, ErrorCategory.InvalidData, null);
            }
            hostedContentFilterRule.Priority = priority;
            hostedContentFilterRule.SetTransportRule(transportRule);
            base.WriteObject(hostedContentFilterRule);
        }
Esempio n. 6
0
 protected override void InternalProcessRecord()
 {
     if (base.DataObject.DomainName != null && base.DataObject.DomainName.Equals(SmtpDomainWithSubdomains.StarDomain))
     {
         base.WriteError(new CannotRemoveDefaultRemoteDomainException(), ErrorCategory.InvalidOperation, this.Identity);
         return;
     }
     base.InternalProcessRecord();
     FfoDualWriter.DeleteFromFfo <DomainContentConfig>(this, base.DataObject);
 }
Esempio n. 7
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 <HostedOutboundSpamFilterPolicy>(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.CreateParentContainerIfNeeded(this.DataObject);
     base.InternalProcessRecord();
     FfoDualWriter.SaveToFfo <HostedContentFilterPolicy>(this, this.DataObject, null);
     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();
        }
Esempio n. 10
0
 private static void LogToFile <T>(T adObject, TenantSettingSyncLogType logType, string oldName) where T : ADObject, new()
 {
     try
     {
         if (FfoDualWriter.HandleRenaming(adObject, oldName))
         {
             TenantSettingSyncLogGenerator.Instance.LogChangesForSave(adObject, logType, new Guid?(adObject.OrganizationalUnitRoot.ObjectGuid), null, new List <KeyValuePair <string, object> >
             {
                 new KeyValuePair <string, object>(FfoDualWriter.oldNameProp.Name, adObject[FfoDualWriter.oldNameProp])
             });
         }
         else
         {
             TenantSettingSyncLogGenerator.Instance.LogChangesForSave(adObject, logType, new Guid?(adObject.OrganizationalUnitRoot.ObjectGuid), null, null);
         }
     }
     catch (Exception ex)
     {
         FfoDualWriter.LogException(ex);
     }
 }
Esempio n. 11
0
        public static void DeleteFromFfo <T>(Task task, T adObject, TenantSettingSyncLogType logType) where T : ADObject, new()
        {
            bool flag = false;

            try
            {
                if (!DatacenterRegistry.IsForefrontForOffice() && !task.CurrentOrganizationId.Equals(OrganizationId.ForestWideOrgId) && DatacenterRegistry.IsDualWriteAllowed())
                {
                    flag = true;
                    FfoDualWriter.FixTenantId(adObject);
                    TenantSettingSyncLogGenerator.Instance.LogChangesForDelete(adObject, logType, new Guid?(adObject.OrganizationalUnitRoot.ObjectGuid));
                    FfoDualWriter.FfoDataProvider.Delete(adObject);
                }
            }
            catch (Exception ex)
            {
                if (flag)
                {
                    FfoDualWriter.LogToFile <T>(adObject, logType, null);
                }
                FfoDualWriter.LogException(ex);
            }
        }
Esempio n. 12
0
 protected override void InternalProcessRecord()
 {
     base.InternalProcessRecord();
     FfoDualWriter.SaveToFfo <TransportRule>(this, this.DataObject, TenantSettingSyncLogType.DUALSYNCTR, null);
 }
Esempio n. 13
0
 protected override void InternalProcessRecord()
 {
     base.InternalProcessRecord();
     FfoDualWriter.DeleteFromFfo <TransportRule>(this, base.DataObject, TenantSettingSyncLogType.DUALSYNCTR);
 }
Esempio n. 14
0
 public static void DeleteFromFfo <T>(Task task, T adObject) where T : ADObject, new()
 {
     FfoDualWriter.DeleteFromFfo <T>(task, adObject, TenantSettingSyncLogGenerator.Instance.GetLogType(adObject));
 }
Esempio n. 15
0
 public static void SaveToFfo <T>(Task task, T adObject, string oldName = null) where T : ADObject, new()
 {
     FfoDualWriter.SaveToFfo <T>(task, adObject, TenantSettingSyncLogGenerator.Instance.GetLogType(adObject), oldName);
 }
Esempio n. 16
0
 public void Save <T>(Task task, T adObject) where T : ADObject, new()
 {
     FfoDualWriter.SaveToFfo <T>(task, adObject, this.oldName);
 }
Esempio n. 17
0
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            if (this.makeDefault && !this.DataObject.Default)
            {
                this.DataObject.Default = true;
                ADPagedReader <AcceptedDomain> adpagedReader = ((IConfigurationSession)base.DataSession).FindPaged <AcceptedDomain>(this.DataObject.Id.Parent, QueryScope.OneLevel, null, null, 0);
                foreach (AcceptedDomain acceptedDomain in adpagedReader)
                {
                    if (acceptedDomain.Default)
                    {
                        acceptedDomain.Default = false;
                        base.DataSession.Save(acceptedDomain);
                    }
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.IsCoexistenceDomain) && this.DataObject.IsCoexistenceDomain != this.IsCoexistenceDomain)
            {
                if (!this.IsCoexistenceDomain)
                {
                    try
                    {
                        AcceptedDomainUtility.DeregisterCoexistenceDomain(this.DataObject.DomainName.Domain);
                        goto IL_162;
                    }
                    catch (TimeoutException exception)
                    {
                        base.WriteError(exception, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (InvalidOperationException exception2)
                    {
                        base.WriteError(exception2, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (SecurityAccessDeniedException exception3)
                    {
                        base.WriteError(exception3, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                    catch (CommunicationException exception4)
                    {
                        base.WriteError(exception4, ErrorCategory.InvalidArgument, null);
                        goto IL_162;
                    }
                }
                try
                {
                    AcceptedDomainUtility.RegisterCoexistenceDomain(this.DataObject.DomainName.Domain);
                }
                catch (TimeoutException exception5)
                {
                    base.WriteError(exception5, ErrorCategory.InvalidArgument, null);
                }
                catch (InvalidOperationException exception6)
                {
                    base.WriteError(exception6, ErrorCategory.InvalidArgument, null);
                }
                catch (SecurityAccessDeniedException exception7)
                {
                    base.WriteError(exception7, ErrorCategory.InvalidArgument, null);
                }
                catch (CommunicationException exception8)
                {
                    base.WriteError(exception8, ErrorCategory.InvalidArgument, null);
                }
IL_162:
                this.DataObject.IsCoexistenceDomain = this.IsCoexistenceDomain;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.RawAuthenticationType))
            {
                this.DataObject.RawAuthenticationType = this.AuthenticationType;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.InitialDomain))
            {
                this.DataObject.InitialDomain = this.InitialDomain;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.RawLiveIdInstanceType))
            {
                this.DataObject.RawLiveIdInstanceType = this.LiveIdInstanceType;
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.EnableNego2Authentication))
            {
                this.DataObject.EnableNego2Authentication = this.EnableNego2Authentication;
                if (ManagementEndpointBase.IsGlobalDirectoryConfigured())
                {
                    IGlobalDirectorySession globalSession = DirectorySessionFactory.GetGlobalSession(null);
                    globalSession.SetDomainFlag(this.DataObject.Name, GlsDomainFlags.Nego2Enabled, this.EnableNego2Authentication);
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.CatchAllRecipient))
            {
                if (this.resolvedCatchAllRecipient != null)
                {
                    this.DataObject.CatchAllRecipientID = this.resolvedCatchAllRecipient.OriginalId;
                }
                else
                {
                    this.DataObject.CatchAllRecipientID = null;
                }
            }
            if (base.Fields.IsModified(AcceptedDomainSchema.MatchSubDomains))
            {
                this.DataObject.MatchSubDomains = this.MatchSubDomains;
            }
            base.InternalProcessRecord();
            FfoDualWriter.SaveToFfo <AcceptedDomain>(this, this.DataObject, TenantSettingSyncLogType.SYNCACCEPTEDDOM, null);
            TaskLogger.LogExit();
        }