public override void Validate(object context)
        {
            Utility.VerifyNonNull("ClaimProperty", this.ClaimProperty);
            Utility.VerifyNonNull("ConditionTag", this.ConditionTag);
            this.ClaimProperty.Validate();
            SelectionRule selectionRule = context as SelectionRule;

            if (selectionRule != null)
            {
                IEnumerator <SelectionCondition> enumerator = selectionRule.Conditions.GetEnumerator();
                using (enumerator)
                {
                    while (enumerator.MoveNext())
                    {
                        SelectionCondition current = enumerator.Current;
                        if (StringComparer.OrdinalIgnoreCase.Compare(this.ConditionTag, current.ConditionTag) != 0)
                        {
                            continue;
                        }
                        return;
                    }
                    object[] conditionTag = new object[1];
                    conditionTag[0] = this.ConditionTag;
                    throw new PolicyValidationException(SR.GetString("POLICY0025", conditionTag));
                }
                return;
            }
            else
            {
                object[] str = new object[1];
                str[0] = context.GetType().ToString();
                throw new PolicyValidationException(SR.GetString("POLICY0015", str));
            }
        }
Ejemplo n.º 2
0
        public override bool Compare(Rule other)
        {
            SelectionRule selectionRule = other as SelectionRule;

            if (selectionRule != null)
            {
                if (this.Conditions.Count == selectionRule.Conditions.Count)
                {
                    int num = 0;
                    while (num < this.Conditions.Count)
                    {
                        if (this.Conditions[num].Compare(selectionRule.Conditions[num]))
                        {
                            num++;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    return(base.Compare(other));
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
		private void HandleRuleBody__Conditions_IMPLY_RuleAction_SEMICOLON()
		{
			Microsoft.ActiveDirectory.TRLParser.LanguageParser.Rule unconditionalRule;
			if (this._policyObjects.Count != 0)
			{
				object obj = this._policyObjects.Peek();
				if (obj.GetType() == typeof(RuleOutput))
				{
					RuleOutput ruleOutput = (RuleOutput)obj;
					this._policyObjects.Pop();
					IssuanceStatement issuanceStatement = this._policyObjects.Peek() as IssuanceStatement;
					if (issuanceStatement != null)
					{
						this._policyObjects.Pop();
						obj = this._policyObjects.Peek();
						if (obj.GetType() == typeof(ConditionType))
						{
							ConditionType conditionType = (ConditionType)obj;
							this._policyObjects.Pop();
							ConditionType conditionType1 = conditionType;
							if (conditionType1 == ConditionType.Unconditional)
							{
								unconditionalRule = new UnconditionalRule(issuanceStatement);
							}
							else if (conditionType1 == ConditionType.Selection)
							{
								unconditionalRule = new SelectionRule(issuanceStatement);
								Collection<SelectionCondition> selectionConditions = this._policyObjects.Peek() as Collection<SelectionCondition>;
								foreach (SelectionCondition selectionCondition in selectionConditions)
								{
									((SelectionRule)unconditionalRule).Conditions.Add(selectionCondition);
								}
								this._policyObjects.Pop();
							}
							else
							{
								object[] objArray = new object[1];
								objArray[0] = (object)conditionType;
								throw new InvalidOperationException(SR.GetString("POLICY0034", objArray));
							}
							unconditionalRule.Output = ruleOutput;
							this._policyObjects.Push(unconditionalRule);
							return;
						}
						else
						{
							object[] objArray1 = new object[1];
							objArray1[0] = "ConditionType";
							throw new InvalidOperationException(SR.GetString("POLICY0037", objArray1));
						}
					}
					else
					{
						object[] objArray2 = new object[1];
						objArray2[0] = "IssuanceStatement";
						throw new InvalidOperationException(SR.GetString("POLICY0037", objArray2));
					}
				}
				else
				{
					object[] objArray3 = new object[1];
					objArray3[0] = "RuleOutput";
					throw new InvalidOperationException(SR.GetString("POLICY0037", objArray3));
				}
			}
			else
			{
				throw new InvalidOperationException(SR.GetString("POLICY0038", new object[0]));
			}
		}