示例#1
0
 internal static TransportRuleAction[] CreateAllAvailableActions(TypeMapping[] mappings, IConfigDataProvider session)
 {
     TransportRuleAction[] array = new TransportRuleAction[mappings.Length];
     for (int i = 0; i < mappings.Length; i++)
     {
         array[i] = TransportRuleAction.InternalCreateAction(mappings[i].Type, mappings, session);
     }
     return(array);
 }
        public static PolicyApplyStatus GetPolicyDistributionStatus(PolicyStorage policyStorage, IList <BindingStorage> bindingStorages, IConfigDataProvider dataSession, out List <PolicyDistributionErrorDetails> distributionErrors, out DateTime?lastStatusUpdateTime)
        {
            ArgumentValidator.ThrowIfNull("policyStorage", policyStorage);
            ArgumentValidator.ThrowIfNull("bindingStorages", bindingStorages);
            ArgumentValidator.ThrowIfNull("dataSession", dataSession);
            PolicySettingStatusHelpers policySettingStatusHelpers = new PolicySettingStatusHelpers(dataSession, null, null);

            return(policySettingStatusHelpers.CalculatePolicyDistributionStatus(policyStorage, bindingStorages, dataSession, out distributionErrors, out lastStatusUpdateTime));
        }
示例#3
0
        // Token: 0x06000B29 RID: 2857 RVA: 0x00023E9C File Offset: 0x0002209C
        IEnumerable <T> IIdentityParameter.GetObjects <T>(ObjectId rootId, IConfigDataProvider session)
        {
            LocalizedString?localizedString;

            return(((IIdentityParameter)this).GetObjects <T>(rootId, session, null, out localizedString));
        }
示例#4
0
        // Token: 0x060002D4 RID: 724 RVA: 0x0000B448 File Offset: 0x00009648
        private IEnumerable <TResult> ResolveIdList <TObject, TResult>(IEnumerable idParameters, IConfigDataProvider session, ObjectId rootId, OptionalIdentityData optionalData, ExchangeErrorCategory errorCategory, Func <IIdentityParameter, LocalizedString> parameterToNotFoundError, Func <IIdentityParameter, LocalizedString> parameterToMultipleFoundError, Func <IConfigurable, TResult> convertToResult, Func <IConfigurable, IConfigurable> validateObject) where TObject : IConfigurable, new()
        {
            Func <IConfigurable, TResult>            func       = null;
            Func <IConfigurable, IConfigurable>      func2      = null;
            Dictionary <TResult, IIdentityParameter> dictionary = new Dictionary <TResult, IIdentityParameter>();

            if (idParameters != null)
            {
                if (convertToResult == null)
                {
                    if (func == null)
                    {
                        func = ((IConfigurable obj) => (TResult)((object)obj.Identity));
                    }
                    convertToResult = func;
                }
                if (validateObject == null)
                {
                    if (func2 == null)
                    {
                        func2 = ((IConfigurable obj) => obj);
                    }
                    validateObject = func2;
                }
                foreach (object obj2 in idParameters)
                {
                    IIdentityParameter identityParameter  = (IIdentityParameter)obj2;
                    LocalizedString?   notFoundError      = (parameterToNotFoundError == null) ? null : new LocalizedString?(parameterToNotFoundError(identityParameter));
                    LocalizedString?   multipleFoundError = (parameterToMultipleFoundError == null) ? null : new LocalizedString?(parameterToMultipleFoundError(identityParameter));
                    IConfigurable      arg = this.GetDataObject <TObject>(identityParameter, session, rootId, notFoundError, multipleFoundError);
                    arg = validateObject(arg);
                    TResult tresult = convertToResult(arg);
                    if (dictionary.ContainsKey(tresult))
                    {
                        throw new ManagementObjectDuplicateException(Strings.ErrorDuplicateManagementObjectFound(dictionary[tresult], identityParameter, tresult));
                    }
                    dictionary.Add(tresult, identityParameter);
                }
            }
            return(dictionary.Keys);
        }
示例#5
0
 public IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where T : IConfigurable, new()
 {
     notFoundReason = null;
     return(session.FindPaged <T>(null, rootId, false, null, 0));
 }
示例#6
0
        // Token: 0x060002C5 RID: 709 RVA: 0x0000B08C File Offset: 0x0000928C
        protected IEnumerable <TObject> GetDataObjects <TObject>(IIdentityParameter id, IConfigDataProvider session, ObjectId rootID, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where TObject : IConfigurable, new()
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            notFoundReason = null;
            base.WriteVerbose(TaskVerboseStringHelper.GetFindByIdParameterVerboseString(id, session ?? this.DataSession, typeof(TObject), rootID));
            IEnumerable <TObject> objects;

            try
            {
                objects = id.GetObjects <TObject>(rootID, session ?? this.DataSession, optionalData, out notFoundReason);
            }
            finally
            {
                base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(session ?? this.DataSession));
            }
            return(objects);
        }
示例#7
0
 // Token: 0x060002D2 RID: 722 RVA: 0x0000B360 File Offset: 0x00009560
 protected MultiValuedProperty <TResult> ResolveIdParameterCollection <TIdParameter, TObject, TResult>(IEnumerable <TIdParameter> idParameters, IConfigDataProvider session, ObjectId rootId, OptionalIdentityData optionalData) where TIdParameter : IIdentityParameter where TObject : IConfigurable, new()
 {
     return(this.ResolveIdParameterCollection <TIdParameter, TObject, TResult>(idParameters, session, rootId, optionalData, (ExchangeErrorCategory)0, null, null, null, null));
 }
 public IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where T : IConfigurable, new()
 {
     notFoundReason = new LocalizedString?(Strings.ErrorCouldNotFindMigrationEndpoint);
     return(this.GetObjects <T>(rootId, session));
 }
示例#9
0
        internal static LocalizedException SetUserInformation(TestCasConnectivity.TestCasConnectivityRunInstance instance, IConfigDataProvider session, ref ADUser user)
        {
            if (session == null)
            {
                throw new LocalizedException(Strings.ErrorNullParameter("session"));
            }
            if (instance == null)
            {
                throw new LocalizedException(Strings.ErrorNullParameter("instance"));
            }
            IRecipientSession recipientSession = session as IRecipientSession;

            if (recipientSession == null)
            {
                throw new LocalizedException(Strings.ErrorNullParameter("recipientSession"));
            }
            if (!string.IsNullOrEmpty(instance.credentials.Domain) && instance.credentials.UserName.IndexOf('@') == -1)
            {
                WindowsIdentity windowsIdentity = null;
                string          text            = instance.credentials.UserName + "@" + instance.credentials.Domain;
                try
                {
                    windowsIdentity = new WindowsIdentity(text);
                }
                catch (SecurityException ex)
                {
                    return(new CasHealthUserNotFoundException(text, ex.Message));
                }
                using (windowsIdentity)
                {
                    user = (recipientSession.FindBySid(windowsIdentity.User) as ADUser);
                    if (user == null)
                    {
                        return(new AdUserNotFoundException(text, string.Empty));
                    }
                    goto IL_174;
                }
            }
            user = null;
            RecipientIdParameter recipientIdParameter = RecipientIdParameter.Parse(instance.credentials.UserName);
            IEnumerable <ADUser> objects = recipientIdParameter.GetObjects <ADUser>(null, recipientSession);

            if (objects != null)
            {
                IEnumerator <ADUser> enumerator = objects.GetEnumerator();
                if (enumerator != null && enumerator.MoveNext())
                {
                    user = enumerator.Current;
                }
                if (enumerator.MoveNext())
                {
                    user = null;
                    return(new AdUserNotUniqueException(instance.credentials.UserName));
                }
            }
            if (user == null)
            {
                return(new AdUserNotFoundException(instance.credentials.UserName, string.Empty));
            }
IL_174:
            return(null);
        }
示例#10
0
        protected override IConfigurable PrepareDataObject()
        {
            TIdentity identity = this.Identity;

            if (identity.OrganizationId != null)
            {
                IDirectorySession writeableSession = this.WriteableSession;
                TIdentity         identity2        = this.Identity;
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(writeableSession, identity2.OrganizationId))
                {
                    IDirectorySession writeableSession2 = this.WriteableSession;
                    TIdentity         identity3         = this.Identity;
                    this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(writeableSession2, identity3.OrganizationId, true);
                }
                IDirectorySession currentOrgConfigSession = this.CurrentOrgConfigSession;
                TIdentity         identity4 = this.Identity;
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(currentOrgConfigSession, identity4.OrganizationId))
                {
                    IDirectorySession currentOrgConfigSession2 = this.CurrentOrgConfigSession;
                    TIdentity         identity5 = this.Identity;
                    this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(currentOrgConfigSession2, identity5.OrganizationId, true);
                    this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession;
                }
            }
            TIdentity identity6 = this.Identity;

            if (!string.IsNullOrEmpty(identity6.MailboxName))
            {
                IRecipientSession writeableSession3 = this.WriteableSession;
                IRecipientSession gcsession         = this.GCSession;
                ADServerSettings  serverSettings    = base.ServerSettings;
                TIdentity         identity7         = this.Identity;
                ADUser            aduser            = RequestTaskHelper.ResolveADUser(writeableSession3, gcsession, serverSettings, new UserIdParameter(identity7.MailboxName), base.OptionalIdentityData, this.DomainController, new DataAccessHelper.CategorizedGetDataObjectDelegate(base.GetDataObject <ADUser>), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), true);
                if (aduser != null)
                {
                    TIdentity identity8 = this.Identity;
                    identity8.MailboxId = aduser.Id;
                    if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.WriteableSession, aduser))
                    {
                        this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.WriteableSession, aduser.OrganizationId, true);
                    }
                    if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, aduser))
                    {
                        this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, aduser.OrganizationId, true);
                        this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession;
                    }
                }
            }
            TIdentity identity9 = this.Identity;

            if (!string.IsNullOrEmpty(identity9.OrganizationName))
            {
                IConfigurationSession configurationSession = RequestTaskHelper.CreateOrganizationFindingSession(base.CurrentOrganizationId, base.ExecutingUserOrganizationId);
                TIdentity             identity10           = this.Identity;
                IIdentityParameter    id                  = new OrganizationIdParameter(identity10.OrganizationName);
                IConfigDataProvider   session             = configurationSession;
                ObjectId             rootID               = null;
                TIdentity            identity11           = this.Identity;
                LocalizedString?     notFoundError        = new LocalizedString?(Strings.ErrorOrganizationNotFound(identity11.OrganizationName));
                TIdentity            identity12           = this.Identity;
                ADOrganizationalUnit adorganizationalUnit = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(id, session, rootID, notFoundError, new LocalizedString?(Strings.ErrorOrganizationNotUnique(identity12.OrganizationName)));
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.WriteableSession, adorganizationalUnit))
                {
                    this.WriteableSession = (IRecipientSession)TaskHelper.UnderscopeSessionToOrganization(this.WriteableSession, adorganizationalUnit.OrganizationId, true);
                }
                if (TaskHelper.ShouldUnderscopeDataSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit))
                {
                    this.CurrentOrgConfigSession = (ITenantConfigurationSession)TaskHelper.UnderscopeSessionToOrganization(this.CurrentOrgConfigSession, adorganizationalUnit.OrganizationId, true);
                    this.RJProvider.IndexProvider.ConfigSession = this.CurrentOrgConfigSession;
                }
            }
            TIdentity identity13 = this.Identity;

            identity13.SetDefaultIndex(this.DefaultRequestIndexId);
            this.IndexEntry = this.GetEntry();
            this.CheckIndexEntry();
            if (this.IndexEntry == null)
            {
                return(null);
            }
            RequestJobObjectId requestJobId = this.IndexEntry.GetRequestJobId();

            if (this.IndexEntry.TargetUserId != null)
            {
                requestJobId.TargetUser = this.ResolveADUser(this.IndexEntry.TargetUserId);
            }
            if (this.IndexEntry.SourceUserId != null)
            {
                requestJobId.SourceUser = this.ResolveADUser(this.IndexEntry.SourceUserId);
            }
            return((TransactionalRequestJob)this.RJProvider.Read <TransactionalRequestJob>(requestJobId));
        }
 internal override void ApplyModification(ADUser modifiedObject, ActiveDirectoryAccessRule[] modifiedAces, IConfigDataProvider modifyingSession)
 {
     PermissionTaskHelper.SetMailboxAces(modifiedObject, modifyingSession, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.ErrorLoggerDelegate(base.WriteError), PermissionTaskHelper.GetReadOnlySession(base.DomainController), ref this.storeSession, false, modifiedAces);
 }
示例#12
0
 internal static IList <PolicyStorage> LoadPolicyStorages(IConfigDataProvider dataSession, PolicyScenario scenarioType)
 {
     return((from PolicyStorage s in dataSession.Find <PolicyStorage>(null, Utils.GetRootId(dataSession), false, null)
             where s.Scenario == scenarioType
             select s).ToList <PolicyStorage>());
 }
示例#13
0
        protected override IConfigurable PrepareDataObject()
        {
            HybridConfiguration   hybridConfiguration = (HybridConfiguration)base.PrepareDataObject();
            IConfigurationSession session             = base.DataSession as IConfigurationSession;

            hybridConfiguration.SetId(session, "Hybrid Configuration");
            if (base.Fields.IsModified("ClientAccessServers"))
            {
                HybridConfiguration  hybridConfiguration2 = hybridConfiguration;
                ADPropertyDefinition clientAccessServers  = HybridConfigurationSchema.ClientAccessServers;
                IConfigDataProvider  dataSession          = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        clientAccessServers2 = this.ClientAccessServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer            = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsClientAccessServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotCAS));
                array[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE14OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotE14CAS));
                hybridConfiguration2.ClientAccessServers = HybridConfigurationTaskUtility.ValidateServers(clientAccessServers, dataSession, clientAccessServers2, getServer, writeError, array);
            }
            if (base.Fields.IsModified("SendingTransportServers"))
            {
                HybridConfiguration  hybridConfiguration3    = hybridConfiguration;
                ADPropertyDefinition sendingTransportServers = HybridConfigurationSchema.SendingTransportServers;
                IConfigDataProvider  dataSession2            = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        sendingTransportServers2 = this.SendingTransportServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer2 = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError2 = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array2 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array2[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsHubTransportServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorSendingTransportServerNotHub));
                array2[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE15OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorSendingTransportServerNotE15Hub));
                hybridConfiguration3.SendingTransportServers = HybridConfigurationTaskUtility.ValidateServers(sendingTransportServers, dataSession2, sendingTransportServers2, getServer2, writeError2, array2);
            }
            if (base.Fields.IsModified("ReceivingTransportServers"))
            {
                HybridConfiguration  hybridConfiguration4      = hybridConfiguration;
                ADPropertyDefinition receivingTransportServers = HybridConfigurationSchema.ReceivingTransportServers;
                IConfigDataProvider  dataSession3 = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        receivingTransportServers2 = this.ReceivingTransportServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer3 = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError3 = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array3 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array3[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsFrontendTransportServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorReceivingTransportServerNotFrontEnd));
                array3[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE15OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorReceivingTransportServerNotE15FrontEnd));
                hybridConfiguration4.ReceivingTransportServers = HybridConfigurationTaskUtility.ValidateServers(receivingTransportServers, dataSession3, receivingTransportServers2, getServer3, writeError3, array3);
            }
            if (base.Fields.IsModified("EdgeTransportServers"))
            {
                HybridConfiguration  hybridConfiguration5 = hybridConfiguration;
                ADPropertyDefinition edgeTransportServers = HybridConfigurationSchema.EdgeTransportServers;
                IConfigDataProvider  dataSession4         = base.DataSession;
                MultiValuedProperty <ServerIdParameter>        edgeTransportServers2 = this.EdgeTransportServers;
                HybridConfigurationTaskUtility.GetUniqueObject getServer4            = new HybridConfigurationTaskUtility.GetUniqueObject(base.GetDataObject <Server>);
                Task.TaskErrorLoggingDelegate writeError4 = new Task.TaskErrorLoggingDelegate(base.WriteError);
                HybridConfigurationTaskUtility.ServerCriterion[] array4 = new HybridConfigurationTaskUtility.ServerCriterion[2];
                array4[0] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsEdgeServer, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotEdge));
                array4[1] = new HybridConfigurationTaskUtility.ServerCriterion((Server s) => s.IsE14Sp1OrLater, new Func <string, LocalizedString>(HybridStrings.HybridErrorServerNotE14Edge));
                hybridConfiguration5.EdgeTransportServers = HybridConfigurationTaskUtility.ValidateServers(edgeTransportServers, dataSession4, edgeTransportServers2, getServer4, writeError4, array4);
            }
            if (base.Fields.IsModified("TlsCertificateName"))
            {
                this.DataObject.TlsCertificateName = this.TlsCertificateName;
            }
            if (base.Fields.IsModified("OnPremisesSmartHost"))
            {
                this.DataObject.OnPremisesSmartHost = this.OnPremisesSmartHost;
            }
            if (base.Fields.IsModified("Domains"))
            {
                this.DataObject.Domains = this.Domains;
            }
            if (base.Fields.IsModified("Features"))
            {
                this.DataObject.Features = this.Features;
            }
            if (base.Fields.IsModified("ExternalIPAddresses"))
            {
                this.DataObject.ExternalIPAddresses = HybridConfigurationTaskUtility.ValidateExternalIPAddresses(this.ExternalIPAddresses, new Task.TaskErrorLoggingDelegate(base.WriteError));
            }
            if (base.Fields.IsModified("ServiceInstance"))
            {
                this.DataObject.ServiceInstance = this.ServiceInstance;
            }
            return(hybridConfiguration);
        }
示例#14
0
 internal static bool TryCreateFromInternalAction(TypeMapping[] mappings, ShortList <Action> actions, ref int index, out TransportRuleAction taskAction, IConfigDataProvider session)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         MethodInfo method  = typeMapping.Type.GetMethod("CreateFromInternalActionWithSession", BindingFlags.Static | BindingFlags.NonPublic);
         MethodInfo method2 = typeMapping.Type.GetMethod("CreateFromInternalAction", BindingFlags.Static | BindingFlags.NonPublic);
         MethodInfo method3 = typeMapping.Type.GetMethod("CreateFromInternalActions", BindingFlags.Static | BindingFlags.NonPublic);
         if (method != null)
         {
             TransportRuleAction transportRuleAction = (TransportRuleAction)method.Invoke(null, new object[]
             {
                 actions[index],
                 session
             });
             if (transportRuleAction != null)
             {
                 index++;
                 taskAction = transportRuleAction;
                 taskAction.Initialize(mappings);
                 return(true);
             }
         }
         else if (method2 != null)
         {
             TransportRuleAction transportRuleAction = (TransportRuleAction)method2.Invoke(null, new object[]
             {
                 actions[index]
             });
             if (transportRuleAction != null)
             {
                 index++;
                 taskAction = transportRuleAction;
                 taskAction.Initialize(mappings);
                 return(true);
             }
         }
         else if (method3 != null)
         {
             object[] array = new object[]
             {
                 actions,
                 index
             };
             TransportRuleAction transportRuleAction = (TransportRuleAction)method3.Invoke(null, array);
             index = (int)array[1];
             if (transportRuleAction != null)
             {
                 taskAction = transportRuleAction;
                 taskAction.Initialize(mappings);
                 return(true);
             }
         }
     }
     taskAction = null;
     return(false);
 }
示例#15
0
 // Token: 0x06000AB5 RID: 2741 RVA: 0x00022FCD File Offset: 0x000211CD
 public virtual QueryFilter GetQueryFilter(IConfigDataProvider session)
 {
     return(null);
 }
        private static Dictionary <Workload, List <ChangeNotificationData> > GenerateSyncs(IEnumerable <UnifiedPolicySettingStatus> syncStatuses, IEnumerable <Workload> workloads, IConfigDataProvider dataSession, UnifiedPolicyStorageBase storageObject, ConfigurationObjectType objectType)
        {
            Dictionary <Workload, List <ChangeNotificationData> > dictionary = new Dictionary <Workload, List <ChangeNotificationData> >();

            if (syncStatuses.Any((UnifiedPolicySettingStatus s) => SetCompliancePolicyBase.HasDistributionFailed(storageObject, s)))
            {
                storageObject.PolicyVersion = CombGuidGenerator.NewGuid();
                dataSession.Save(storageObject);
                foreach (Workload workload in workloads)
                {
                    dictionary[workload] = new List <ChangeNotificationData>
                    {
                        AggregatedNotificationClients.CreateChangeData(workload, storageObject)
                    };
                }
            }
            return(dictionary);
        }
示例#17
0
        // Token: 0x060002C4 RID: 708 RVA: 0x0000B070 File Offset: 0x00009270
        protected IEnumerable <TObject> GetDataObjects <TObject>(IIdentityParameter id, IConfigDataProvider session, ObjectId rootID) where TObject : IConfigurable, new()
        {
            LocalizedString?localizedString;

            return(this.GetDataObjects <TObject>(id, session, rootID, null, out localizedString));
        }
示例#18
0
        public static void ValidateDatabaseCopyActionTask(DatabaseCopy databaseCopy, bool allowInvalidDbCopy, bool fCheckDbReplicated, IConfigDataProvider session, ObjectId rootId, Task.TaskErrorLoggingDelegate writeError, LocalizedString mdbNotUniqueError, LocalizedString?singleDbCopyError, out Server server)
        {
            string databaseName = databaseCopy.DatabaseName;

            server = null;
            Database database = databaseCopy.GetDatabase <Database>();

            DatabaseTasksHelper.CheckDatabaseForCopyTaskImpl(database, fCheckDbReplicated, writeError, singleDbCopyError);
            if (database.Recovery)
            {
                writeError(new InvalidOperationException(Strings.ErrorInvalidOperationOnRecoveryMailboxDatabase(database.Name)), ErrorCategory.InvalidOperation, database.Identity);
            }
            if (databaseCopy.HostServer != null)
            {
                MailboxServerIdParameter serverIdParam = new MailboxServerIdParameter(databaseCopy.HostServer);
                server = databaseCopy.Session.Read <Server>(databaseCopy.HostServer);
                DatabaseTasksHelper.CheckServerObjectForCopyTask(serverIdParam, writeError, server);
                return;
            }
            if (!allowInvalidDbCopy && !databaseCopy.IsHostServerValid)
            {
                writeError(new InvalidOperationException(Strings.ErrorDbCopyHostServerInvalid(databaseCopy.Name)), ErrorCategory.InvalidData, databaseCopy);
            }
        }
示例#19
0
 // Token: 0x060002D1 RID: 721 RVA: 0x0000B34C File Offset: 0x0000954C
 protected IConfigurable GetDataObject <TObject>(IIdentityParameter id, IConfigDataProvider session, ObjectId rootID, LocalizedString?notFoundError, LocalizedString?multipleFoundError, ExchangeErrorCategory errorCategory) where TObject : IConfigurable, new()
 {
     return(this.GetDataObject <TObject>(id, session, rootID, null, notFoundError, multipleFoundError, errorCategory));
 }
示例#20
0
 // Token: 0x06000CBE RID: 3262 RVA: 0x00027CC4 File Offset: 0x00025EC4
 IEnumerable <T> IIdentityParameter.GetObjects <T>(ObjectId rootId, IConfigDataProvider session)
 {
     return(this.GetObjects <T>(rootId, session));
 }
示例#21
0
        // Token: 0x060002D3 RID: 723 RVA: 0x0000B380 File Offset: 0x00009580
        protected MultiValuedProperty <TResult> ResolveIdParameterCollection <TIdParameter, TObject, TResult>(IEnumerable <TIdParameter> idParameters, IConfigDataProvider session, ObjectId rootId, OptionalIdentityData optionalData, ExchangeErrorCategory errorCategory, Func <IIdentityParameter, LocalizedString> parameterToNotFoundError, Func <IIdentityParameter, LocalizedString> parameterToMultipleFoundError, Func <IConfigurable, TResult> convertToResult, Func <IConfigurable, IConfigurable> validateObject) where TIdParameter : IIdentityParameter where TObject : IConfigurable, new()
        {
            MultiValuedProperty <TIdParameter> multiValuedProperty = idParameters as MultiValuedProperty <TIdParameter>;
            MultiValuedProperty <TResult>      result;

            if (multiValuedProperty != null && multiValuedProperty.IsChangesOnlyCopy)
            {
                Hashtable hashtable = new Hashtable();
                if (multiValuedProperty.Added.Length > 0)
                {
                    IEnumerable <TResult> value = this.ResolveIdList <TObject, TResult>(multiValuedProperty.Added, session, rootId, optionalData, errorCategory, parameterToNotFoundError, parameterToMultipleFoundError, convertToResult, validateObject);
                    hashtable.Add("Add", value);
                }
                if (multiValuedProperty.Removed.Length > 0)
                {
                    IEnumerable <TResult> value2 = this.ResolveIdList <TObject, TResult>(multiValuedProperty.Removed, session, rootId, optionalData, errorCategory, parameterToNotFoundError, parameterToMultipleFoundError, convertToResult, null);
                    hashtable.Add("Remove", value2);
                }
                result = new MultiValuedProperty <TResult>(hashtable);
            }
            else
            {
                IEnumerable <TResult> value3 = this.ResolveIdList <TObject, TResult>(idParameters, session, rootId, optionalData, errorCategory, parameterToNotFoundError, parameterToMultipleFoundError, convertToResult, validateObject);
                result = new MultiValuedProperty <TResult>(value3);
            }
            return(result);
        }
        protected void DismountDatabase()
        {
            TDataObject dataObject = base.DataObject;

            base.WriteVerbose(Strings.VerboseConnectionAdminRpcInterface(this.server.Fqdn));
            using (IStoreRpc newStoreControllerInstance = Dependencies.GetNewStoreControllerInstance(this.server.Fqdn))
            {
                base.WriteVerbose(Strings.VerboseCheckDatabaseStatus(dataObject.Identity.ToString()));
                Guid[] dbGuids = new Guid[]
                {
                    dataObject.Guid
                };
                bool        flag = false;
                MdbStatus[] array;
                if (this.ListMdbStatus(newStoreControllerInstance, dbGuids, out array) == null)
                {
                    if (array == null || array.Length == 0)
                    {
                        TaskLogger.Trace("The database being removed does not have storage", new object[0]);
                        return;
                    }
                    if (MdbStatusFlags.Backup == (array[0].Status & MdbStatusFlags.Backup))
                    {
                        base.WriteError(new InvalidOperationException(Strings.ErrorBackupInProgress(dataObject.Name)), ErrorCategory.InvalidOperation, dataObject.Identity);
                    }
                    else if (MdbStatusFlags.Online == (array[0].Status & MdbStatusFlags.Online))
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    base.WriteVerbose(Strings.VerboseUnmountDatabase(this.Identity.ToString()));
                    TDataObject dataObject2 = base.DataObject;
                    if (dataObject2.IsExchange2009OrLater)
                    {
                        try
                        {
                            AmRpcClientHelper.DismountDatabase(ADObjectWrapperFactory.CreateWrapper(base.DataObject), 0);
                            goto IL_300;
                        }
                        catch (AmServerException ex)
                        {
                            Exception ex2;
                            if (ex.TryGetExceptionOrInnerOfType(out ex2))
                            {
                                TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else if (ex.TryGetExceptionOrInnerOfType(out ex2))
                            {
                                TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else if (ex.TryGetExceptionOrInnerOfType(out ex2))
                            {
                                TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else if (ex.TryGetExceptionOrInnerOfType(out ex2))
                            {
                                TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else if (ex.TryGetExceptionOrInnerOfType(out ex2))
                            {
                                TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex2.Message
                                });
                            }
                            else
                            {
                                TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while unmounting database: {0}", new object[]
                                {
                                    ex.Message
                                });
                                Exception     exception   = ex;
                                ErrorCategory category    = ErrorCategory.InvalidOperation;
                                TDataObject   dataObject3 = base.DataObject;
                                base.WriteError(exception, category, dataObject3.Identity);
                            }
                            goto IL_300;
                        }
                        catch (AmServerTransientException ex3)
                        {
                            TaskLogger.Trace("RemoveDatabase.InternalProcessRecord raises exception while dismounting database: {0}", new object[]
                            {
                                ex3.Message
                            });
                            Exception     exception2  = ex3;
                            ErrorCategory category2   = ErrorCategory.InvalidOperation;
                            TDataObject   dataObject4 = base.DataObject;
                            base.WriteError(exception2, category2, dataObject4.Identity);
                            goto IL_300;
                        }
                    }
                    IConfigDataProvider        dataSession = base.DataSession;
                    TDataObject                dataObject5 = base.DataObject;
                    LegacyPublicFolderDatabase legacyPublicFolderDatabase = (LegacyPublicFolderDatabase)dataSession.Read <LegacyPublicFolderDatabase>(dataObject5.Identity);
                    StorageGroup               storageGroup = (StorageGroup)base.DataSession.Read <StorageGroup>(legacyPublicFolderDatabase.StorageGroup);
                    newStoreControllerInstance.UnmountDatabase(storageGroup.Guid, legacyPublicFolderDatabase.Guid, 0);
                }
                IL_300 :;
            }
        }
示例#23
0
        public IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session) where T : IConfigurable, new()
        {
            LocalizedString?localizedString;

            return(this.GetObjects <T>(rootId, session, null, out localizedString));
        }
示例#24
0
 IEnumerable <T> IIdentityParameter.GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason)
 {
     return(this.GetObjects <T>(rootId, session, optionalData, out notFoundReason));
 }
        private PolicyApplyStatus CalculatePolicyDistributionStatus(PolicyStorage policyStorage, IList <BindingStorage> bindingStorages, IConfigDataProvider dataSession, out List <PolicyDistributionErrorDetails> distributionErrors, out DateTime?lastStatusUpdateTime)
        {
            this.WriteVerbose(Strings.VerboseBeginCalculatePolicyDistributionStatus(policyStorage.Name), true);
            distributionErrors   = new List <PolicyDistributionErrorDetails>();
            lastStatusUpdateTime = null;
            bool flag         = false;
            int  warningCount = 0;

            flag = this.CalculatePolicyDistributionStatus(new List <UnifiedPolicyStorageBase>(new UnifiedPolicyStorageBase[]
            {
                policyStorage
            }), null, ref distributionErrors, ref lastStatusUpdateTime);
            flag = (flag || this.CalculatePolicyDistributionStatus(bindingStorages, null, ref distributionErrors, ref lastStatusUpdateTime));
            if (!flag)
            {
                IList <RuleStorage> storageObjects = Utils.LoadRuleStoragesByPolicy(dataSession, policyStorage, Utils.GetRootId(dataSession));
                if (this.CalculatePolicyDistributionStatus(storageObjects, null, ref distributionErrors, ref lastStatusUpdateTime))
                {
                    flag = true;
                }
            }
            distributionErrors.ForEach(delegate(PolicyDistributionErrorDetails errorDetails)
            {
                BindingStorage bindingStorage2 = bindingStorages.FirstOrDefault((BindingStorage binding) => binding.Workload == errorDetails.Workload);
                if (bindingStorage2 == null || !bindingStorage2.AppliedScopes.Any <ScopeStorage>())
                {
                    errorDetails.Severity = PolicyDistributionResultSeverity.Warning;
                    errorDetails.AppendAdditionalDiagnosticsInfo(errorDetails.ResultMessage);
                    errorDetails.ResultMessage = Strings.DeploymentFailureWithNoImpact;
                    warningCount++;
                    this.WriteVerbose(Strings.VerboseTreatAsWarning(errorDetails.Endpoint, errorDetails.ObjectType.ToString(), errorDetails.Workload.ToString()), false);
                }
            });
            List <PolicyDistributionErrorDetails> collection = new List <PolicyDistributionErrorDetails>();

            if (!flag)
            {
                foreach (BindingStorage bindingStorage in bindingStorages)
                {
                    this.CalculatePolicyDistributionStatus(bindingStorage.AppliedScopes, new Workload?(bindingStorage.Workload), ref collection, ref lastStatusUpdateTime);
                }
            }
            List <PolicyDistributionErrorDetails> list = distributionErrors.FindAll((PolicyDistributionErrorDetails errorDetails) => errorDetails.ResultCode != UnifiedPolicyErrorCode.PolicySyncTimeout);
            int timeoutErrorCount = distributionErrors.Count - list.Count;
            PolicyApplyStatus policyApplyStatus;

            if (flag || (list.Count != distributionErrors.Count && lastStatusUpdateTime != null && lastStatusUpdateTime.Value.Add(PolicySettingStatusHelpers.policySyncTimeoutInterval) > DateTime.UtcNow))
            {
                policyApplyStatus    = PolicyApplyStatus.Pending;
                lastStatusUpdateTime = null;
                distributionErrors   = list;
                timeoutErrorCount    = 0;
            }
            else
            {
                if (warningCount == distributionErrors.Count)
                {
                    distributionErrors.AddRange(collection);
                }
                policyApplyStatus = ((warningCount < distributionErrors.Count) ? PolicyApplyStatus.Error : PolicyApplyStatus.Success);
            }
            this.WriteVerbose(Strings.VerboseEndCalculatePolicyDistributionStatus(policyStorage.Name, policyApplyStatus.ToString(), distributionErrors.Count, timeoutErrorCount), true);
            return(policyApplyStatus);
        }
示例#26
0
 // Token: 0x060009B2 RID: 2482 RVA: 0x00021087 File Offset: 0x0001F287
 public IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session, OptionalIdentityData optionalData, out LocalizedString?notFoundReason) where T : IConfigurable, new()
 {
     throw new NotImplementedException();
 }
        public static void PopulatePolicyDistributionStatus(PsCompliancePolicyBase psPolicy, PolicyStorage policyStorage, IConfigDataProvider dataSession, Task task = null, ExecutionLog logger = null)
        {
            ArgumentValidator.ThrowIfNull("psPolicy", psPolicy);
            ArgumentValidator.ThrowIfNull("policyStorage", policyStorage);
            ArgumentValidator.ThrowIfNull("dataSession", dataSession);
            PolicySettingStatusHelpers            policySettingStatusHelpers = new PolicySettingStatusHelpers(dataSession, task, logger);
            List <PolicyDistributionErrorDetails> value;
            DateTime?lastStatusUpdateTime;

            psPolicy.DistributionStatus   = policySettingStatusHelpers.CalculatePolicyDistributionStatus(policyStorage, psPolicy.StorageBindings, dataSession, out value, out lastStatusUpdateTime);
            psPolicy.LastStatusUpdateTime = lastStatusUpdateTime;
            psPolicy.DistributionResults  = new MultiValuedProperty <PolicyDistributionErrorDetails>(value);
        }
示例#28
0
 // Token: 0x060009B3 RID: 2483 RVA: 0x0002108E File Offset: 0x0001F28E
 public IEnumerable <T> GetObjects <T>(ObjectId rootId, IConfigDataProvider session) where T : IConfigurable, new()
 {
     throw new NotImplementedException();
 }
 private static void ValidateRouteAllMessagesViaOnPremisesParameter(TenantOutboundConnector dataObject, IConfigDataProvider dataSession, Task task)
 {
     if (dataObject.RouteAllMessagesViaOnPremises && !NewInboundConnector.FindTenantScopedOnPremiseInboundConnector(dataSession, null))
     {
         task.WriteError(new CMCConnectorRequiresTenantScopedInboundConnectorException(), ErrorCategory.InvalidArgument, null);
     }
 }
示例#30
0
 internal static TransportRuleAction CreateAction(TypeMapping[] mappings, string name, IConfigDataProvider session)
 {
     foreach (TypeMapping typeMapping in mappings)
     {
         if (name.Equals(typeMapping.Name, StringComparison.OrdinalIgnoreCase))
         {
             return(TransportRuleAction.InternalCreateAction(typeMapping.Type, mappings, session));
         }
     }
     return(null);
 }