Ejemplo n.º 1
0
        public AddDirectoryCacheRequest(List <Tuple <string, KeyType> > keys, ADRawEntry objectToCache, string forestFqdn, OrganizationId organizationId, IEnumerable <PropertyDefinition> properties, int secondsTimeout = 2147483646, CacheItemPriority priority = CacheItemPriority.Default)
        {
            ArgumentValidator.ThrowIfNull("keys", keys);
            ArgumentValidator.ThrowIfNull("objectToCache", objectToCache);
            ArgumentValidator.ThrowIfOutOfRange <int>("secondsTimeout", secondsTimeout, 1, 2147483646);
            ArgumentValidator.ThrowIfNull("organizationId", organizationId);
            if (keys.Count == 0)
            {
                throw new InvalidOperationException("Keys should not be empty");
            }
            this.Keys = keys;
            ADObject adobject = objectToCache as ADObject;

            if (adobject != null)
            {
                this.Object = SimpleADObject.CreateFrom(adobject, properties);
            }
            else
            {
                this.Object = SimpleADObject.CreateFromRawEntry(objectToCache, properties, true);
            }
            this.ObjectType            = CacheUtils.GetObjectTypeFor(objectToCache.GetType(), true);
            this.SecondsTimeout        = secondsTimeout;
            this.Priority              = priority;
            base.ForestOrPartitionFqdn = forestFqdn;
            base.InternalSetOrganizationId(organizationId);
        }
Ejemplo n.º 2
0
        // Token: 0x060008DE RID: 2270 RVA: 0x0002791C File Offset: 0x00025B1C
        private bool IsObjectEligibleForRecentlyCreatedBehavior(ADRawEntry rawEntry)
        {
            if (rawEntry == null)
            {
                return(false);
            }
            if (!this.IsCacheEnabled(rawEntry.GetType()))
            {
                return(false);
            }
            RecipientTypeDetails?recipientTypeDetails = rawEntry[ADRecipientSchema.RecipientTypeDetails] as RecipientTypeDetails?;

            if (!this.newObjectBehaviorConfiguration.IsRecipientTypeDetailsEnabled(recipientTypeDetails))
            {
                return(false);
            }
            DateTime?dateTime = rawEntry[ADObjectSchema.WhenCreatedUTC] as DateTime?;

            return(dateTime != null && this.newObjectBehaviorConfiguration.IsDateTimeWithinInclusionThreshold(dateTime.Value));
        }
        // Token: 0x06001A8F RID: 6799 RVA: 0x0006F468 File Offset: 0x0006D668
        private void PopulateCalculatedProperties(ADRawEntry entry)
        {
            MiniRecipient miniRecipient = entry as MiniRecipient;
            bool          flag          = false;

            foreach (ADPropertyDefinition adpropertyDefinition in this.CachedADProperties)
            {
                if (adpropertyDefinition.IsCalculated)
                {
                    if (miniRecipient == null || miniRecipient.HasSupportingProperties(adpropertyDefinition))
                    {
                        object obj = entry[adpropertyDefinition];
                    }
                    else
                    {
                        flag = true;
                        ComponentTrace <ADRecipientCacheTags> .TraceInformation <string>(0, (long)this.GetHashCode(), "After lookup, supporting properties are missing for the calculated property: {0}.", adpropertyDefinition.Name);
                    }
                }
            }
            if (flag)
            {
                ComponentTrace <ADRecipientCacheTags> .TraceWarning <string>(0, (long)this.GetHashCode(), "Supporting properties were missing for the type: {0}.", entry.GetType().Name);
            }
        }
        protected override bool InternalTryValidate(ADRawEntry adObject, out RuleValidationException validationException)
        {
            validationException = null;
            CapabilityIdentifierEvaluator capabilityIdentifierEvaluator = base.RestrictedCapabilityEvaluators.FirstOrDefault((CapabilityIdentifierEvaluator x) => CapabilityEvaluationResult.Yes == x.Evaluate(adObject));

            ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ExpressionFilterValidationRule.InternalTryValidate({0}). CurlpritCapability {1}.", adObject.GetDistinguishedNameOrName(), (capabilityIdentifierEvaluator != null) ? capabilityIdentifierEvaluator.Capability.ToString() : "<NULL>");
            if (capabilityIdentifierEvaluator == null)
            {
                return(true);
            }
            foreach (ValidationRuleExpression validationRuleExpression in base.RuleDefinition.Expressions)
            {
                if (validationRuleExpression.ApplicableObjects != null && validationRuleExpression.ApplicableObjects.Count > 0)
                {
                    Type right = validationRuleExpression.ApplicableObjects.FirstOrDefault((Type x) => x.IsAssignableFrom(adObject.GetType()));
                    if (null == right)
                    {
                        ExTraceGlobals.AccessCheckTracer.TraceDebug <string, Type, string>((long)this.GetHashCode(), "ExpressionFilterValidationRule.InternalTryValidate({0}). Object type '{1}' is not on the list of applicable types for expression {2}.", adObject.GetDistinguishedNameOrName(), adObject.GetType(), validationRuleExpression.QueryString);
                        continue;
                    }
                }
                bool flag = true;
                foreach (PropertyDefinition propertyDefinition in validationRuleExpression.QueryFilter.FilterProperties())
                {
                    if (!adObject.propertyBag.Contains((ProviderPropertyDefinition)propertyDefinition))
                    {
                        ExTraceGlobals.AccessCheckTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ExpressionFilterValidationRule.InternalTryValidate({0}). Missing Property {1}.", adObject.GetDistinguishedNameOrName(), propertyDefinition.Name);
                        flag = false;
                        break;
                    }
                }
                if (flag && !OpathFilterEvaluator.FilterMatches(validationRuleExpression.QueryFilter, adObject) && !base.IsOverridingAllowCapabilityFound(adObject))
                {
                    validationException = new RuleValidationException(base.GetValidationRuleErrorMessage(adObject, capabilityIdentifierEvaluator.Capability));
                    return(false);
                }
            }
            return(true);
        }