示例#1
0
 internal override void StampPersistableDefaultValues()
 {
     if (this.SupportedPresentationObjectTypes != null && !base.IsModified(ADProvisioningPolicySchema.TargetObjects) && this.TargetObjects.Count == 0)
     {
         foreach (Type poType in this.SupportedPresentationObjectTypes)
         {
             this.TargetObjects.Add(ProvisioningHelper.GetProvisioningObjectTag(poType));
         }
     }
     base.StampPersistableDefaultValues();
 }
        // Token: 0x0600607A RID: 24698 RVA: 0x00147E54 File Offset: 0x00146054
        public override ProvisioningValidationError[] Validate(ADProvisioningPolicy enforcementPolicy, IConfigurable readOnlyPresentationObject)
        {
            base.Validate(enforcementPolicy, readOnlyPresentationObject);
            ADObject adobject;

            if (readOnlyPresentationObject is ADPublicFolder)
            {
                adobject = (ADPublicFolder)readOnlyPresentationObject;
            }
            else
            {
                adobject = (MailEnabledRecipient)readOnlyPresentationObject;
            }
            Unlimited <int> fromValue = (Unlimited <int>)enforcementPolicy[base.CountQuotaProperty];

            if (!fromValue.IsUnlimited && (T)fromValue >= 0)
            {
                int  num = (T)fromValue;
                bool flag;
                if (num == 0)
                {
                    flag = true;
                }
                else
                {
                    string domainController = null;
                    if (base.Context != null && base.Context.UserSpecifiedParameters != null && base.Context.UserSpecifiedParameters.Contains("DomainController"))
                    {
                        object obj = base.Context.UserSpecifiedParameters["DomainController"];
                        if (obj != null)
                        {
                            domainController = obj.ToString();
                        }
                    }
                    ADSessionSettings     sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), adobject.OrganizationId, null, false);
                    IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(domainController, true, ConsistencyMode.FullyConsistent, sessionSettings, 178, "Validate", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\Provisioning\\RecipientResourceCountQuota.cs");
                    flag = SystemAddressListMemberCount.IsQuotaExceded(tenantOrTopologyConfigurationSession, adobject.OrganizationId, base.SystemAddressListName, num);
                }
                if (flag)
                {
                    string          policyId = string.Format("{0}: {1}", enforcementPolicy.Identity.ToString(), base.CountQuotaProperty.Name);
                    LocalizedString description;
                    if (adobject.OrganizationalUnitRoot == null)
                    {
                        description = DirectoryStrings.ErrorExceededHosterResourceCountQuota(policyId, (readOnlyPresentationObject.GetType() == typeof(ADPublicFolder)) ? "MailPublicFolder" : ProvisioningHelper.GetProvisioningObjectTag(readOnlyPresentationObject.GetType()), num);
                    }
                    else
                    {
                        description = DirectoryStrings.ErrorExceededMultiTenantResourceCountQuota(policyId, (readOnlyPresentationObject.GetType() == typeof(ADPublicFolder)) ? "MailPublicFolder" : ProvisioningHelper.GetProvisioningObjectTag(readOnlyPresentationObject.GetType()), adobject.OrganizationalUnitRoot.Name, num);
                    }
                    return(new ProvisioningValidationError[]
                    {
                        new ProvisioningValidationError(description, ExchangeErrorCategory.ServerOperation, null)
                    });
                }
            }
            return(null);
        }