Пример #1
0
		/// <summary>
		/// Creates a new runtime policy evaluation.
		/// </summary>
		/// <param name="policy">The policy document.</param>
		public Policy( pol.PolicyElement policy )
		{
            if (policy == null) throw new ArgumentNullException("policy");
			_policy = policy;
			
			// Chechs the target for this policy.
			if( policy.Target != null )
			{
				_target = new Target( (pol.TargetElement)policy.Target );

				// Load all the resources for this policy.
				foreach( pol.ResourceElement resource in policy.Target.Resources.ItemsList )
				{
					foreach( pol.ResourceMatchElement rmatch in resource.Match )
					{
						if( !_allResources.Contains( rmatch.AttributeValue.Contents ) )
						{
							_allResources.Add( rmatch.AttributeValue.Contents );
						}
					}
				}
			}

			// Load all the Rules and creates a new runtime rule.
			foreach( pol.RuleElement rule in policy.Rules )
			{
				Rule ruleEv = new Rule( rule );
				_rules.Add( ruleEv );

				foreach( string rName in ruleEv.AllResources )
				{
					if( !_allResources.Contains( rName ) )
					{
						_allResources.Add( rName );
					}
				}
			}
		}
Пример #2
0
		/// <summary>
		/// Adds an object to the end of the CollectionBase.
		/// </summary>
		/// <param name="value">The Object to be added to the end of the CollectionBase. </param>
		/// <returns>The CollectionBase index at which the value has been added.</returns>
		public int Add( Rule value )  
		{
			return( List.Add( value ) );
		}