コード例 #1
0
        protected virtual void PrepareRecipientObject(ref TDataObject dataObject)
        {
            ADUser aduser = dataObject as ADUser;

            if (aduser != null)
            {
                if (base.Fields.IsModified("SKUCapability"))
                {
                    aduser.SKUCapability = new Capability?(this.SKUCapability);
                }
                if (base.Fields.IsModified("AddOnSKUCapability"))
                {
                    CapabilityHelper.SetAddOnSKUCapabilities(this.AddOnSKUCapability, aduser.PersistedCapabilities);
                    RecipientTaskHelper.UpgradeArchiveQuotaOnArchiveAddOnSKU(aduser, aduser.PersistedCapabilities);
                }
                if (base.Fields.IsModified(ADRecipientSchema.SKUAssigned))
                {
                    aduser.SKUAssigned = new bool?(this.SKUAssigned);
                }
                if (base.Fields.IsModified(ADRecipientSchema.UsageLocation))
                {
                    aduser.UsageLocation = this.UsageLocation;
                }
            }
        }
コード例 #2
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter(new object[]
     {
         this.DataObject
     });
     this.IsSetRandomPassword = false;
     if (this.DataObject.IsChanged(MailboxSchema.WindowsLiveID))
     {
         this.IsSetRandomPassword = true;
         if (this.DataObject.IsChanged(MailboxSchema.NetID))
         {
             MailboxTaskHelper.IsLiveIdExists((IRecipientSession)base.DataSession, this.DataObject.WindowsLiveID, this.DataObject.NetID, new Task.ErrorLoggerDelegate(base.WriteError));
         }
     }
     if (base.Fields.IsModified("SKUCapability"))
     {
         this.DataObject.SKUCapability = new Capability?(this.SKUCapability);
     }
     if (base.Fields.IsModified("AddOnSKUCapability"))
     {
         CapabilityHelper.SetAddOnSKUCapabilities(this.AddOnSKUCapability, this.DataObject.PersistedCapabilities);
         RecipientTaskHelper.UpgradeArchiveQuotaOnArchiveAddOnSKU(this.DataObject, this.DataObject.PersistedCapabilities);
     }
     if (this.IsChangingOnPassword && this.HasSetPasswordPermission)
     {
         ((IRecipientSession)base.DataSession).SetPassword(this.DataObject, this.Password);
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
コード例 #3
0
ファイル: NewApp.cs プロジェクト: YHZX2013/exchange_diff
        protected override IConfigDataProvider CreateSession()
        {
            ADObjectId executingUserId;

            if (!base.TryGetExecutingUserId(out executingUserId) && this.Mailbox == null)
            {
                return(this.CreateDataProviderForNonMailboxUser());
            }
            MailboxIdParameter mailboxIdParameter = this.Mailbox ?? MailboxTaskHelper.ResolveMailboxIdentity(executingUserId, new Task.ErrorLoggerDelegate(base.WriteError));

            try
            {
                this.adUser = (ADUser)base.GetDataObject <ADUser>(mailboxIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxNotFound(mailboxIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxNotUnique(mailboxIdParameter.ToString())));
            }
            catch (ManagementObjectNotFoundException)
            {
                return(this.CreateDataProviderForNonMailboxUser());
            }
            this.isBposUser = CapabilityHelper.HasBposSKUCapability(this.adUser.PersistedCapabilities);
            ADScopeException ex;

            if (!TaskHelper.UnderscopeSessionToOrganization(base.TenantGlobalCatalogSession, this.adUser.OrganizationId, true).TryVerifyIsWithinScopes(this.adUser, true, out ex))
            {
                base.WriteError(new InvalidOperationException(Strings.ErrorCannotChangeMailboxOutOfWriteScope(this.adUser.Identity.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ErrorCategory.InvalidOperation, this.adUser.Identity);
            }
            IConfigDataProvider configDataProvider = GetApp.CreateOwaExtensionDataProvider(null, base.TenantGlobalCatalogSession, base.SessionSettings, !this.OrganizationApp, this.adUser, "New-App", false, new Task.ErrorLoggerDelegate(base.WriteError));

            this.mailboxOwner = ((OWAExtensionDataProvider)configDataProvider).MailboxSession.MailboxOwner.ObjectId.ToString();
            return(configDataProvider);
        }
コード例 #4
0
        // Token: 0x060039E0 RID: 14816 RVA: 0x000DFCD0 File Offset: 0x000DDED0
        internal void ApplyCloneableProperties(ADPresentationObject source)
        {
            IEnumerable <PropertyInfo> enabledPropertiesFromPropertyInfoList = ADPresentationObject.GetEnabledPropertiesFromPropertyInfoList(source);

            IEnumerable <PropertyInfo>[] array = new IEnumerable <PropertyInfo>[]
            {
                this.CloneableOnceProperties,
                this.CloneableProperties,
                enabledPropertiesFromPropertyInfoList
            };
            foreach (IEnumerable <PropertyInfo> enumerable in array)
            {
                foreach (PropertyInfo propertyInfo in enumerable)
                {
                    object value  = propertyInfo.GetValue(source, null);
                    object value2 = propertyInfo.GetValue(this, null);
                    if (value != null && value2 != value)
                    {
                        MultiValuedPropertyBase multiValuedPropertyBase = value as MultiValuedPropertyBase;
                        if (multiValuedPropertyBase == null || multiValuedPropertyBase.Count != 0)
                        {
                            if (propertyInfo.PropertyType == typeof(MultiValuedProperty <Capability>))
                            {
                                MultiValuedProperty <Capability> multiValuedProperty = (MultiValuedProperty <Capability>)value;
                                CapabilityHelper.SetSKUCapability((multiValuedProperty.Count == 0) ? null : new Capability?(multiValuedProperty[0]), (MultiValuedProperty <Capability>)value2);
                            }
                            else
                            {
                                propertyInfo.SetValue(this, value, null);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        private async void InitPageData()
        {
            hasBroadFileSystemAccess = await CapabilityHelper.CheckBroadFileSystemAccess();

            if (!hasBroadFileSystemAccess)
            {
                CapabilityHelper.SubmitBroadFileSystemAccess();
            }
            await LoadPackages();
        }
コード例 #6
0
        public bool IsLicensingEnforcedInOrg(OrganizationId organizationId)
        {
            ArgumentValidator.ThrowIfNull("organizationId", organizationId);
            bool isLicensingEnforcedInOrg = false;

            this.DoAdCallAndTranslateExceptions(delegate
            {
                isLicensingEnforcedInOrg = CapabilityHelper.GetIsLicensingEnforcedInOrg(organizationId);
            }, "DirectoryAccessor::IsLicensingEnforcedInOrg");
            return(isLicensingEnforcedInOrg);
        }
コード例 #7
0
        public static Capability GetExchangeCapability(XmlElement xmlCapability)
        {
            Capability result;

            try
            {
                result = (Capability)Enum.Parse(typeof(Capability), CapabilityHelper.TransformCapabilityString(xmlCapability.GetAttribute("MailboxPlan").Trim()), true);
            }
            catch (ArgumentException)
            {
                result = Capability.None;
            }
            return(result);
        }
コード例 #8
0
        private static MultiValuedProperty <Capability> GetEffectiveAddOnSKUCapabilities(IPropertyBag propertyBag)
        {
            MultiValuedProperty <AssignedPlanValue> multiValuedProperty  = (MultiValuedProperty <AssignedPlanValue>)propertyBag[SyncUserSchema.AssignedPlan];
            MultiValuedProperty <Capability>        multiValuedProperty2 = new MultiValuedProperty <Capability>();

            if (multiValuedProperty != null && multiValuedProperty.Count != 0)
            {
                foreach (AssignedPlanValue assignedPlanValue in multiValuedProperty)
                {
                    Capability exchangeCapability = SyncUser.GetExchangeCapability(assignedPlanValue.Capability);
                    if (CapabilityHelper.IsAddOnSKUCapability(exchangeCapability) && assignedPlanValue.CapabilityStatus != AssignedCapabilityStatus.Deleted)
                    {
                        multiValuedProperty2.Add(exchangeCapability);
                    }
                }
            }
            return(multiValuedProperty2);
        }
コード例 #9
0
ファイル: UserContext.cs プロジェクト: YHZX2013/exchange_diff
        protected override void DoLoad(OwaIdentity logonIdentity, OwaIdentity mailboxIdentity, UserContextStatistics stats)
        {
            HttpContext          httpContext = HttpContext.Current;
            RequestDetailsLogger current     = RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext);

            RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.UserContextLoadBegin);
            base.DoLoad(logonIdentity, mailboxIdentity, stats);
            RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.GetOWAMiniRecipientBegin);
            Stopwatch        stopwatch        = Stopwatch.StartNew();
            OWAMiniRecipient owaminiRecipient = base.LogonIdentity.GetOWAMiniRecipient();

            stats.MiniRecipientCreationTime = (int)stopwatch.ElapsedMilliseconds;
            RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.GetOWAMiniRecipientEnd);
            base.LogTrace("UserContext.Load", "GetOWAMiniRecipient finished");
            this.sipUri = ADPersonToContactConverter.GetSipUri(owaminiRecipient);
            stopwatch.Restart();
            this.IsBposUser             = CapabilityHelper.HasBposSKUCapability(owaminiRecipient.PersistedCapabilities);
            stats.SKUCapabilityTestTime = (int)stopwatch.ElapsedMilliseconds;
            base.LogTrace("UserContext.Load", "HasBposSKUCapability finished");
            if (Globals.IsFirstReleaseFlightingEnabled)
            {
                this.CreateFeatureManagerFactory(owaminiRecipient);
            }
            else
            {
                RecipientTypeDetails recipientTypeDetails = base.ExchangePrincipal.RecipientTypeDetails;
                this.featuresManagerFactory = new FeaturesManagerFactory(owaminiRecipient, new ConfigurationContext(this), new ScopeFlightsSettingsProvider(), (VariantConfigurationSnapshot c) => new FeaturesStateOverride(c, recipientTypeDetails), string.Empty, false);
            }
            this.BposSkuCapability = string.Empty;
            if (this.IsBposUser)
            {
                Capability?skucapability = CapabilityHelper.GetSKUCapability(owaminiRecipient.PersistedCapabilities);
                if (skucapability != null)
                {
                    this.BposSkuCapability = skucapability.ToString();
                }
            }
            this.LogEventCommonData = new LogEventCommonData(this);
            this.IsGroupUserContext = (base.IsExplicitLogon && base.ExchangePrincipal.RecipientTypeDetails == RecipientTypeDetails.GroupMailbox);
            RequestDetailsLogger.LogEvent(current, OwaServerLogger.LoggerData.UserContextLoadEnd);
        }
コード例 #10
0
        public static void InitializeDatabase(this IApplicationBuilder app)
        {
            var databaseSettings = DependencyResolver.Resolve <IDatabaseSettings>();

            if (databaseSettings.HasSettings())
            {
                //upgrade to latest version
                DatabaseManager.UpgradeDatabase();

                //upgrade capabilities
                CapabilityHelper.UpgradeCapabilities();

                //mark plugin data
                var pluginAccountant  = DependencyResolver.Resolve <IPluginAccountant>();
                var availablePlugins  = pluginAccountant.GetAvailablePlugins(true);
                var installedVersions = DatabaseManager.GetInstalledVersions();
                foreach (var plugin in availablePlugins)
                {
                    var dbPlugin = plugin.LoadPluginInstance <DatabasePlugin>();
                    plugin.Dirty = installedVersions.ContainsKey(plugin.SystemName) &&
                                   dbPlugin.IsDatabaseUpgradeRequired(installedVersions[plugin.SystemName]);
                }
            }
        }
コード例 #11
0
        private static AssignedPlanValue GetEffectiveRootServicePlan(IPropertyBag propertyBag)
        {
            AssignedPlanValue assignedPlanValue = null;
            MultiValuedProperty <AssignedPlanValue> multiValuedProperty = (MultiValuedProperty <AssignedPlanValue>)propertyBag[SyncUserSchema.AssignedPlan];

            if (multiValuedProperty != null && multiValuedProperty.Count != 0)
            {
                IOrderedEnumerable <AssignedPlanValue> source = from ap in multiValuedProperty
                                                                orderby ap.AssignedTimestamp descending
                                                                select ap;
                foreach (AssignedPlanValue assignedPlanValue2 in from ap in source
                         where ap.CapabilityStatus != AssignedCapabilityStatus.Deleted
                         select ap)
                {
                    if (CapabilityHelper.IsRootSKUCapability(SyncUser.GetExchangeCapability(assignedPlanValue2.Capability)))
                    {
                        assignedPlanValue = assignedPlanValue2;
                        break;
                    }
                }
                if (assignedPlanValue == null)
                {
                    foreach (AssignedPlanValue assignedPlanValue3 in from ap in source
                             where ap.CapabilityStatus == AssignedCapabilityStatus.Deleted
                             select ap)
                    {
                        if (CapabilityHelper.IsRootSKUCapability(SyncUser.GetExchangeCapability(assignedPlanValue3.Capability)))
                        {
                            assignedPlanValue = assignedPlanValue3;
                            break;
                        }
                    }
                }
            }
            return(assignedPlanValue);
        }
コード例 #12
0
ファイル: NewUserBase.cs プロジェクト: YHZX2013/exchange_diff
        protected override void PrepareRecipientObject(ADUser user)
        {
            TaskLogger.LogEnter();
            string userPrincipalName = user.UserPrincipalName;

            base.PrepareRecipientObject(user);
            bool flag = base.Fields.Contains("SoftDeletedObject");

            if (flag && userPrincipalName != user.UserPrincipalName)
            {
                user.UserPrincipalName = userPrincipalName;
            }
            using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "NewUserBase.PrepareUserObject", LoggerHelper.CmdletPerfMonitors))
            {
                this.PrepareUserObject(user);
            }
            if (!string.IsNullOrEmpty(this.ImmutableId))
            {
                this.DataObject.ImmutableId = this.ImmutableId;
            }
            if (base.IsDebugOn)
            {
                base.WriteDebug(Strings.DebugStartUpnUniquenessCheck);
            }
            using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "RecipientTaskHelper.IsUserPrincipalNameUnique", LoggerHelper.CmdletPerfMonitors))
            {
                RecipientTaskHelper.IsUserPrincipalNameUnique(base.TenantGlobalCatalogSession, user, user.UserPrincipalName, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), ExchangeErrorCategory.ServerOperation, !flag);
            }
            if (base.IsDebugOn)
            {
                base.WriteDebug(Strings.DebugEndUpnUniquenessCheck);
            }
            if (!string.IsNullOrEmpty(user.SamAccountName))
            {
                using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "RecipientTaskHelper.IsSamAccountNameUnique", LoggerHelper.CmdletPerfMonitors))
                {
                    RecipientTaskHelper.IsSamAccountNameUnique(base.TenantGlobalCatalogSession, user, user.SamAccountName, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError), ExchangeErrorCategory.Client, !flag);
                    goto IL_2C1;
                }
            }
            bool useRandomSuffix = this.WindowsLiveID != null && this.WindowsLiveID.SmtpAddress != SmtpAddress.Empty;

            if (base.IsDebugOn)
            {
                base.WriteDebug(Strings.DebugStartGeneratingUniqueSamAccountName);
            }
            using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "RecipientTaskHelper.PrepareRecipientObject/VariantConfiguration", LoggerHelper.CmdletPerfMonitors))
            {
                IRecipientSession[] recipientSessions = new IRecipientSession[]
                {
                    base.RootOrgGlobalCatalogSession
                };
                if (VariantConfiguration.InvariantNoFlightingSnapshot.CmdletInfra.ServiceAccountForest.Enabled && base.CurrentOrganizationId != OrganizationId.ForestWideOrgId)
                {
                    recipientSessions = new IRecipientSession[]
                    {
                        base.RootOrgGlobalCatalogSession,
                        base.PartitionOrRootOrgGlobalCatalogSession
                    };
                }
                using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "RecipientTaskHelper.GenerateUniqueSamAccountName", LoggerHelper.CmdletPerfMonitors))
                {
                    user.SamAccountName = RecipientTaskHelper.GenerateUniqueSamAccountName(recipientSessions, user.Id.DomainId, RecipientTaskHelper.GetLocalPartOfUserPrincalName(user.UserPrincipalName), false, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), useRandomSuffix);
                }
            }
            if (base.IsDebugOn)
            {
                base.WriteDebug(Strings.DebugEndGeneratingUniqueSamAccountName);
            }
IL_2C1:
            if (string.IsNullOrEmpty(user.Alias))
            {
                using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "RecipientTaskHelper.GenerateUniqueAlias", LoggerHelper.CmdletPerfMonitors))
                {
                    user.Alias = RecipientTaskHelper.GenerateUniqueAlias(base.TenantGlobalCatalogSession, user.OrganizationId, string.IsNullOrEmpty(user.UserPrincipalName) ? user.SamAccountName : RecipientTaskHelper.GetLocalPartOfUserPrincalName(user.UserPrincipalName), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose));
                }
            }
            if (base.Fields.IsModified("SKUCapability"))
            {
                user.SKUCapability = new Capability?(this.SKUCapability);
            }
            if (base.Fields.IsModified("AddOnSKUCapability"))
            {
                CapabilityHelper.SetAddOnSKUCapabilities(this.AddOnSKUCapability, user.PersistedCapabilities);
                RecipientTaskHelper.UpgradeArchiveQuotaOnArchiveAddOnSKU(user, user.PersistedCapabilities);
            }
            if (base.Fields.IsModified(ADRecipientSchema.SKUAssigned))
            {
                user.SKUAssigned = new bool?(this.SKUAssigned);
            }
            TaskLogger.LogExit();
        }
コード例 #13
0
 private static object ConvertSingleValueForDirectoryProperty(SyncPropertyDefinition property, object value)
 {
     if (object.Equals(property.DefaultValue, value) && !property.PersistDefaultValue)
     {
         return(SyncValueConvertor.IgnoreValue);
     }
     if (value == null)
     {
         return(null);
     }
     if (typeof(DirectoryPropertyString).IsAssignableFrom(property.ExternalType) || property.ExternalType == typeof(string))
     {
         return(ADValueConvertor.ConvertValueToString(value, property.FormatProvider));
     }
     if (typeof(DirectoryPropertyGuid).IsAssignableFrom(property.ExternalType))
     {
         return(ADValueConvertor.ConvertValueToString(value, property.FormatProvider));
     }
     if (typeof(DirectoryPropertyBinary).IsAssignableFrom(property.ExternalType))
     {
         return(ADValueConvertor.ConvertValueToBinary(value, property.FormatProvider));
     }
     if (typeof(DirectoryPropertyBoolean).IsAssignableFrom(property.ExternalType))
     {
         return(bool.Parse(ADValueConvertor.ConvertValueToString(value, property.FormatProvider)));
     }
     if (typeof(DirectoryPropertyInt32).IsAssignableFrom(property.ExternalType))
     {
         return(int.Parse(ADValueConvertor.ConvertValueToString(value, property.FormatProvider)));
     }
     if (typeof(DirectoryPropertyDateTime).IsAssignableFrom(property.ExternalType))
     {
         Type type = value.GetType();
         if (type.Equals(typeof(DateTime)))
         {
             return(((DateTime)value).ToUniversalTime());
         }
         return(DateTime.Parse(ADValueConvertor.ConvertValueToString(value, property.FormatProvider), property.FormatProvider));
     }
     else
     {
         if (typeof(DirectoryPropertyXmlServiceOriginatedResource) == property.ExternalType && value is Capability)
         {
             Capability capability = (Capability)value;
             if (CapabilityHelper.IsAllowedSKUCapability(capability))
             {
                 Guid skucapabilityGuid = CapabilityHelper.GetSKUCapabilityGuid(capability);
                 if (skucapabilityGuid != Guid.Empty)
                 {
                     return(new XmlValueServiceOriginatedResource
                     {
                         Resource = new ServiceOriginatedResourceValue
                         {
                             ServicePlanId = skucapabilityGuid.ToString("D"),
                             Capability = capability.ToString()
                         }
                     });
                 }
             }
             return(SyncValueConvertor.IgnoreValue);
         }
         if (typeof(DirectoryPropertyXmlDirSyncStatus).IsAssignableFrom(property.ExternalType))
         {
             string stringValue = (string)value;
             return(new XmlValueDirSyncStatus
             {
                 DirSyncStatus = SyncValueConvertor.ConvertStringToDirSyncStatus(stringValue)
             });
         }
         if (typeof(DirectoryPropertyReferenceAddressList).IsAssignableFrom(property.ExternalType) && value is PropertyReference)
         {
             PropertyReference propertyReference = (PropertyReference)value;
             return(new DirectoryReferenceAddressList
             {
                 TargetClass = propertyReference.TargetObjectClass,
                 Value = propertyReference.TargetId,
                 TargetDeleted = propertyReference.TargetDeleted
             });
         }
         throw new NotSupportedException("Conversion for external type " + property.ExternalType.Name);
     }
 }
コード例 #14
0
        // Token: 0x060039E1 RID: 14817 RVA: 0x000DFDF8 File Offset: 0x000DDFF8
        internal static void ApplyPresentationObjectDelta(ADPresentationObject oldPlan, ADPresentationObject newPlan, ADPresentationObject target, ApplyMailboxPlanFlags flags)
        {
            IEnumerable <PropertyInfo> enabledPropertiesFromPropertyInfoList = ADPresentationObject.GetEnabledPropertiesFromPropertyInfoList(newPlan, oldPlan);

            IEnumerable <PropertyInfo>[] array;
            if (oldPlan == null)
            {
                array = new IEnumerable <PropertyInfo>[]
                {
                    target.CloneableOnceProperties,
                    target.CloneableProperties,
                    enabledPropertiesFromPropertyInfoList
                };
            }
            else
            {
                array = new IEnumerable <PropertyInfo>[]
                {
                    target.CloneableProperties,
                    enabledPropertiesFromPropertyInfoList
                };
            }
            bool flag = oldPlan == null && newPlan != null && flags.HasFlag(ApplyMailboxPlanFlags.PreservePreviousExplicitlySetValues);

            foreach (IEnumerable <PropertyInfo> enumerable in array)
            {
                foreach (PropertyInfo propertyInfo in enumerable)
                {
                    object obj   = null;
                    object value = propertyInfo.GetValue(newPlan, null);
                    MultiValuedPropertyBase multiValuedPropertyBase = value as MultiValuedPropertyBase;
                    if (oldPlan != null)
                    {
                        obj = propertyInfo.GetValue(oldPlan, null);
                    }
                    if (propertyInfo.PropertyType == typeof(MultiValuedProperty <Capability>))
                    {
                        if (!object.Equals(obj, value))
                        {
                            MultiValuedProperty <Capability> sourceCapabilities = MultiValuedProperty <Capability> .Empty;
                            if (value != null)
                            {
                                sourceCapabilities = (MultiValuedProperty <Capability>)value;
                            }
                            CapabilityHelper.SetSKUCapabilities(newPlan.Name, sourceCapabilities, (MultiValuedProperty <Capability>)propertyInfo.GetValue(target, null));
                        }
                    }
                    else if (obj != null || value != null)
                    {
                        if (obj == null || value == null)
                        {
                            if (flag)
                            {
                                object value2 = propertyInfo.GetValue(target, null);
                                ADPropertyDefinition adpropertyDefinition = newPlan.Schema[propertyInfo.Name] as ADPropertyDefinition;
                                if (adpropertyDefinition != null && ((adpropertyDefinition.DefaultValue == null && value2 != null) || (adpropertyDefinition.DefaultValue != null && !adpropertyDefinition.DefaultValue.Equals(value2))))
                                {
                                    continue;
                                }
                            }
                            propertyInfo.SetValue(target, value, null);
                        }
                        else if (!obj.Equals(value))
                        {
                            if (multiValuedPropertyBase == null)
                            {
                                propertyInfo.SetValue(target, value, null);
                            }
                            else
                            {
                                bool flag2 = false;
                                MultiValuedPropertyBase multiValuedPropertyBase2 = obj as MultiValuedPropertyBase;
                                if (multiValuedPropertyBase2.Count != multiValuedPropertyBase.Count)
                                {
                                    flag2 = true;
                                }
                                else
                                {
                                    foreach (object obj2 in ((IEnumerable)multiValuedPropertyBase2))
                                    {
                                        bool flag3 = false;
                                        foreach (object obj3 in ((IEnumerable)multiValuedPropertyBase))
                                        {
                                            if (obj2.Equals(obj3))
                                            {
                                                flag3 = true;
                                                break;
                                            }
                                        }
                                        if (!flag3)
                                        {
                                            flag2 = true;
                                            break;
                                        }
                                    }
                                }
                                if (flag2)
                                {
                                    propertyInfo.SetValue(target, value, null);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #15
0
ファイル: Camera.cs プロジェクト: mbahar94/SharpSenses
 public static ICamera Create()
 {
     return(Create(CapabilityHelper.All()));
 }
コード例 #16
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ExchangeConfigurationUnit exchangeConfigurationUnit = (ExchangeConfigurationUnit)base.PrepareDataObject();

            if (base.Fields.IsModified(OrganizationSchema.DefaultMovePriority))
            {
                exchangeConfigurationUnit.DefaultMovePriority = this.DefaultMovePriority;
            }
            if (base.Fields.IsModified("TenantSKUCapability"))
            {
                CapabilityHelper.SetTenantSKUCapabilities(this.PersistedCapabilities, exchangeConfigurationUnit.PersistedCapabilities);
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeMessage))
            {
                exchangeConfigurationUnit.UpgradeMessage = this.UpgradeMessage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeDetails))
            {
                exchangeConfigurationUnit.UpgradeDetails = this.UpgradeDetails;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeConstraints))
            {
                exchangeConfigurationUnit.UpgradeConstraints = this.UpgradeConstraints;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeStage))
            {
                exchangeConfigurationUnit.UpgradeStage = this.UpgradeStage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeStageTimeStamp))
            {
                exchangeConfigurationUnit.UpgradeStageTimeStamp = this.UpgradeStageTimeStamp;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeE14RequestCountForCurrentStage))
            {
                exchangeConfigurationUnit.UpgradeE14RequestCountForCurrentStage = this.UpgradeE14RequestCountForCurrentStage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeE14MbxCountForCurrentStage))
            {
                exchangeConfigurationUnit.UpgradeE14MbxCountForCurrentStage = this.UpgradeE14MbxCountForCurrentStage;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeLastE14CountsUpdateTime))
            {
                exchangeConfigurationUnit.UpgradeLastE14CountsUpdateTime = this.UpgradeLastE14CountsUpdateTime;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeConstraintsDisabled))
            {
                exchangeConfigurationUnit.UpgradeConstraintsDisabled = this.UpgradeConstraintsDisabled;
            }
            if (base.Fields.IsModified(OrganizationSchema.UpgradeUnitsOverride))
            {
                exchangeConfigurationUnit.UpgradeUnitsOverride = this.UpgradeUnitsOverride;
            }
            if (base.Fields.IsModified(OrganizationSchema.MaxAddressBookPolicies))
            {
                exchangeConfigurationUnit.MaxAddressBookPolicies = new int?(this.MaxAddressBookPolicies);
            }
            if (base.Fields.IsModified(OrganizationSchema.MaxOfflineAddressBooks))
            {
                exchangeConfigurationUnit.MaxOfflineAddressBooks = new int?(this.MaxOfflineAddressBooks);
            }
            if (this.RemoveSharedConfigurations)
            {
                exchangeConfigurationUnit.SupportedSharedConfigurations.Clear();
            }
            if (base.Fields.IsModified(OrganizationSchema.SupportedSharedConfigurations))
            {
                if (this.ClearPreviousSharedConfigurations)
                {
                    exchangeConfigurationUnit.SupportedSharedConfigurations.Clear();
                }
                foreach (ExchangeConfigurationUnit exchangeConfigurationUnit2 in this.SharedConfigurationUnits)
                {
                    if (!exchangeConfigurationUnit.SupportedSharedConfigurations.Contains(exchangeConfigurationUnit2.OrganizationId.ConfigurationUnit))
                    {
                        exchangeConfigurationUnit.SupportedSharedConfigurations.Add(exchangeConfigurationUnit2.Identity);
                    }
                }
            }
            if (base.Fields.IsModified(OrganizationSchema.EnableAsSharedConfiguration))
            {
                exchangeConfigurationUnit.EnableAsSharedConfiguration = this.EnableAsSharedConfiguration;
            }
            if (base.Fields.IsModified(OrganizationSchema.ImmutableConfiguration))
            {
                exchangeConfigurationUnit.ImmutableConfiguration = this.ImmutableConfiguration;
            }
            if (base.Fields.IsModified(OrganizationSchema.IsDehydrated))
            {
                exchangeConfigurationUnit.IsDehydrated = this.IsDehydrated;
            }
            if (base.Fields.IsModified(OrganizationSchema.IsStaticConfigurationShared))
            {
                exchangeConfigurationUnit.IsStaticConfigurationShared = this.IsStaticConfigurationShared;
            }
            if (base.Fields.IsModified(OrganizationSchema.IsUpdatingServicePlan))
            {
                exchangeConfigurationUnit.IsUpdatingServicePlan = this.IsUpdatingServicePlan;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.ProgramId))
            {
                exchangeConfigurationUnit.ProgramId = this.ProgramId;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.OfferId))
            {
                exchangeConfigurationUnit.OfferId = this.OfferId;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.ServicePlan))
            {
                exchangeConfigurationUnit.ServicePlan = this.ServicePlan;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.TargetServicePlan))
            {
                exchangeConfigurationUnit.TargetServicePlan = this.TargetServicePlan;
            }
            if (!exchangeConfigurationUnit.HostingDeploymentEnabled && Datacenter.IsPartnerHostedOnly(false))
            {
                exchangeConfigurationUnit.HostingDeploymentEnabled = true;
            }
            if (base.Fields.IsModified(OrganizationSchema.ExcludedFromBackSync))
            {
                exchangeConfigurationUnit.ExcludedFromBackSync = this.ExcludedFromBackSync;
            }
            if (base.Fields.IsModified(OrganizationSchema.ExcludedFromForwardSyncEDU2BPOS))
            {
                exchangeConfigurationUnit.ExcludedFromForwardSyncEDU2BPOS = this.ExcludedFromForwardSyncEDU2BPOS;
            }
            if (base.Fields.IsModified(ExchangeConfigurationUnitSchema.ExchangeUpgradeBucket))
            {
                if (this.ExchangeUpgradeBucket != null)
                {
                    ExchangeUpgradeBucket exchangeUpgradeBucket = (ExchangeUpgradeBucket)base.GetDataObject <ExchangeUpgradeBucket>(this.ExchangeUpgradeBucket, base.GlobalConfigSession, null, new LocalizedString?(Strings.ErrorExchangeUpgradeBucketNotFound(this.ExchangeUpgradeBucket.ToString())), new LocalizedString?(Strings.ErrorExchangeUpgradeBucketNotUnique(this.ExchangeUpgradeBucket.ToString())));
                    UpgradeBucketTaskHelper.ValidateOrganizationVersion(exchangeConfigurationUnit, exchangeUpgradeBucket, new Task.ErrorLoggerDelegate(base.WriteError));
                    UpgradeBucketTaskHelper.ValidateOrganizationAddition(base.GlobalConfigSession, exchangeConfigurationUnit.OrganizationId, exchangeUpgradeBucket, new Task.ErrorLoggerDelegate(base.WriteError));
                    exchangeConfigurationUnit.ExchangeUpgradeBucket = (ADObjectId)exchangeUpgradeBucket.Identity;
                }
                else
                {
                    exchangeConfigurationUnit.ExchangeUpgradeBucket = null;
                }
            }
            if (base.Fields.IsModified(OrganizationSchema.MailboxRelease))
            {
                exchangeConfigurationUnit.MailboxRelease = this.MailboxRelease;
            }
            if (base.Fields.IsModified(OrganizationSchema.PreviousMailboxRelease))
            {
                exchangeConfigurationUnit.PreviousMailboxRelease = this.PreviousMailboxRelease;
            }
            if (base.Fields.IsModified(OrganizationSchema.PilotMailboxRelease))
            {
                exchangeConfigurationUnit.PilotMailboxRelease = this.PilotMailboxRelease;
            }
            if (base.Fields.IsModified("AddRelocationConstraint"))
            {
                RelocationConstraint      constraintToAdd = new RelocationConstraint((RelocationConstraintType)this.RelocationConstraintType, DateTime.UtcNow.AddDays((double)this.RelocationConstraintExpirationInDays));
                RelocationConstraintArray persistedRelocationConstraints = SetOrganization.PopulateRelocationConstraintsList(exchangeConfigurationUnit.PersistedRelocationConstraints, this.RelocationConstraintType, constraintToAdd);
                exchangeConfigurationUnit.PersistedRelocationConstraints = persistedRelocationConstraints;
            }
            else if (base.Fields.IsModified("RemoveRelocationConstraint"))
            {
                RelocationConstraintArray persistedRelocationConstraints2 = SetOrganization.PopulateRelocationConstraintsList(exchangeConfigurationUnit.PersistedRelocationConstraints, this.RelocationConstraintType, null);
                exchangeConfigurationUnit.PersistedRelocationConstraints = persistedRelocationConstraints2;
            }
            OrganizationStatus organizationStatus;

            if (exchangeConfigurationUnit.IsModified(ExchangeConfigurationUnitSchema.OrganizationStatus) && exchangeConfigurationUnit.TryGetOriginalValue <OrganizationStatus>(ExchangeConfigurationUnitSchema.OrganizationStatus, out organizationStatus))
            {
                if (OrganizationStatus.Active == exchangeConfigurationUnit.OrganizationStatus && (OrganizationStatus.Suspended == organizationStatus || OrganizationStatus.LockedOut == organizationStatus))
                {
                    exchangeConfigurationUnit.IsTenantAccessBlocked = false;
                }
                else if ((OrganizationStatus.Suspended == exchangeConfigurationUnit.OrganizationStatus || OrganizationStatus.LockedOut == exchangeConfigurationUnit.OrganizationStatus) && OrganizationStatus.Active == organizationStatus)
                {
                    exchangeConfigurationUnit.IsTenantAccessBlocked = true;
                }
            }
            if (base.Fields.IsModified(OrganizationSchema.IsLicensingEnforced))
            {
                exchangeConfigurationUnit.IsLicensingEnforced = this.IsLicensingEnforced;
            }
            TaskLogger.LogExit();
            return(exchangeConfigurationUnit);
        }