Esempio n. 1
0
        /// <summary>
        /// Creates a new instance of the evaluaion context.
        /// </summary>
        /// <param name="engine">The engine instance.</param>
        /// <param name="policyDocument">The policy document instance.</param>
        /// <param name="contextDocument">The context document instance.</param>
        public EvaluationContext(EvaluationEngine engine, pol.PolicyDocument policyDocument, ctx.ContextDocument contextDocument)
            : this()
        {
            ctx.AttributeReadWriteCollection attributes = new ctx.AttributeReadWriteCollection();
            foreach (ctx.AttributeElementReadWrite attribute in contextDocument.Request.Resources[0].Attributes)
            {
                attributes.Add(new ctx.AttributeElementReadWrite(attribute));
            }

            ctx.ResourceContentElement resourceContent = null;
            if (contextDocument.Request.Resources[0].ResourceContent != null)
            {
                resourceContent = new ctx.ResourceContentElement(
                    contextDocument.Request.Resources[0].ResourceContent.XmlDocument,
                    contextDocument.Request.Resources[0].ResourceContent.SchemaVersion);
            }

            _engine          = engine;
            _policyDocument  = policyDocument;
            _contextDocument = contextDocument;
            _currentResource = new ctx.ResourceElementReadWrite(
                resourceContent,
                contextDocument.Request.Resources[0].ResourceScopeValue,
                attributes,
                contextDocument.Request.Resources[0].SchemaVersion);
        }
Esempio n. 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 override int Add(ResourceElementReadWrite value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            ResourceContentElement resourceContent = null;

            if (value.ResourceContent != null)
            {
                resourceContent = new ResourceContentElement(value.ResourceContent.XmlDocument, value.ResourceContent.SchemaVersion);
            }
            return(List.Add(new ResourceElement(resourceContent, value.ResourceScopeValue, new AttributeCollection(value.Attributes), value.SchemaVersion)));
        }
Esempio n. 3
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 override int Add( ResourceElementReadWrite value )  
		{
            if (value == null) throw new ArgumentNullException("value");
			ResourceContentElement resourceContent = null;
			if( value.ResourceContent != null )
			{
				resourceContent = new ResourceContentElement(value.ResourceContent.XmlDocument, value.ResourceContent.SchemaVersion);
			}
			return( List.Add( new ResourceElement( resourceContent, value.ResourceScopeValue, new AttributeCollection(value.Attributes), value.SchemaVersion ) ) );
		}
Esempio n. 4
0
		/// <summary>
		/// Creates a new instance of the evaluaion context.
		/// </summary>
		/// <param name="engine">The engine instance.</param>
		/// <param name="policyDocument">The policy document instance.</param>
		/// <param name="contextDocument">The context document instance.</param>
		public EvaluationContext( EvaluationEngine engine, pol.PolicyDocument policyDocument, ctx.ContextDocument contextDocument )
			: this()
		{
			ctx.AttributeReadWriteCollection attributes = new ctx.AttributeReadWriteCollection();
			foreach( ctx.AttributeElementReadWrite attribute in contextDocument.Request.Resources[0].Attributes )
			{
				attributes.Add( new ctx.AttributeElementReadWrite( attribute ) );
			}

			ctx.ResourceContentElement resourceContent = null;
			if( contextDocument.Request.Resources[0].ResourceContent != null )
			{
				resourceContent = new ctx.ResourceContentElement( 
						contextDocument.Request.Resources[0].ResourceContent.XmlDocument, 
						contextDocument.Request.Resources[0].ResourceContent.SchemaVersion );
			}

			_engine = engine;
			_policyDocument = policyDocument;
			_contextDocument = contextDocument;
			_currentResource = new ctx.ResourceElementReadWrite( 
				resourceContent,
				contextDocument.Request.Resources[0].ResourceScopeValue, 
				attributes, 
				contextDocument.Request.Resources[0].SchemaVersion );
		}
Esempio n. 5
0
 /// <summary>
 /// Creates a Resource using the specified arguments.
 /// </summary>
 /// <param name="resourceScope">The resource scope for this target item.</param>
 /// <param name="resourceContent">The resource content in the context document.</param>
 /// <param name="attributes">The attribute list.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public ResourceElement(ResourceContentElement resourceContent, ResourceScope resourceScope, AttributeCollection attributes, XacmlVersion schemaVersion)
     : base(resourceContent, resourceScope, attributes, schemaVersion)
 {
 }
Esempio n. 6
0
		/// <summary>
		/// Creates a Resource using the specified arguments.
		/// </summary>
		/// <param name="resourceScope">The resource scope for this target item.</param>
		/// <param name="resourceContent">The resource content in the context document.</param>
		/// <param name="attributes">The attribute list.</param>
		/// <param name="schemaVersion">The version of the schema that was used to validate.</param>
		public ResourceElement( ResourceContentElement resourceContent, ResourceScope resourceScope, AttributeCollection attributes, XacmlVersion schemaVersion ) 
			: base( resourceContent, resourceScope, attributes, schemaVersion )
		{
		}