/// <summary>
 /// Creates a new Request using the XmlReader instance provided.
 /// </summary>
 /// <param name="reader">The XmlReader positioned at the Request node.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public RequestElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     if (reader == null) throw new ArgumentNullException("reader");
     if (reader.LocalName == Consts.ContextSchema.RequestElement.Request)
     {
         while (reader.Read())
         {
             switch (reader.LocalName)
             {
                 case Consts.ContextSchema.RequestElement.Subject:
                     _subjects.Add(new SubjectElementReadWrite(reader, schemaVersion));
                     break;
                 case Consts.ContextSchema.RequestElement.Resource:
                     _resources.Add(new ResourceElementReadWrite(reader, schemaVersion));
                     break;
                 case Consts.ContextSchema.RequestElement.Action:
                     _action = new ActionElementReadWrite(reader, schemaVersion);
                     break;
                 case Consts.ContextSchema.RequestElement.Environment:
                     _environment = new EnvironmentElementReadWrite(reader, schemaVersion);
                     break;
             }
         }
     }
     else
     {
         throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
     }
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new Request using the parameters specified.
 /// </summary>
 /// <param name="subjects">The subjects list.</param>
 /// <param name="resources">The resource requested</param>
 /// <param name="action">The action requested.</param>
 /// <param name="environment">Any environment attribute part of the request.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public RequestElementReadWrite(SubjectReadWriteCollection subjects, ResourceReadWriteCollection resources, ActionElementReadWrite action, EnvironmentElementReadWrite environment, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     _subjects    = subjects;
     _resources   = resources;
     _action      = action;
     _environment = environment;
 }
 /// <summary>
 /// Creates a new Request using the parameters specified.
 /// </summary>
 /// <param name="subjects">The subjects list.</param>
 /// <param name="resources">The resource requested</param>
 /// <param name="action">The action requested.</param>
 /// <param name="environment">Any environment attribute part of the request.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public RequestElementReadWrite(SubjectReadWriteCollection subjects, ResourceReadWriteCollection resources, ActionElementReadWrite action, EnvironmentElementReadWrite environment, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     _subjects = subjects;
     _resources = resources;
     _action = action;
     _environment = environment;
 }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="environment"></param>
        public Environment(con.EnvironmentElementReadWrite environment)
        {
            _environment = environment;

            this.Text = "Environment";
            this.SelectedImageIndex = 2;
            this.ImageIndex         = 2;

            foreach (con.AttributeElementReadWrite attr in _environment.Attributes)
            {
                this.Nodes.Add(new Attribute(attr));
            }
        }
Beispiel #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="environment"></param>
        public Environment( con.EnvironmentElementReadWrite environment )
        {
            _environment = environment;

            this.Text = "Environment";
            this.SelectedImageIndex = 2;
            this.ImageIndex = 2;

            foreach( con.AttributeElementReadWrite attr in _environment.Attributes )
            {
                this.Nodes.Add( new Attribute( attr ) );
            }
        }
Beispiel #6
0
        /// <summary>
        /// Creates a new Request using the XmlReader instance provided.
        /// </summary>
        /// <param name="reader">The XmlReader positioned at the Request node.</param>
        /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
        public RequestElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
            : base(XacmlSchema.Context, schemaVersion)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.LocalName == Consts.ContextSchema.RequestElement.Request)
            {
                while (reader.Read())
                {
                    switch (reader.LocalName)
                    {
                    case Consts.ContextSchema.RequestElement.Subject:
                        _subjects.Add(new SubjectElementReadWrite(reader, schemaVersion));
                        break;

                    case Consts.ContextSchema.RequestElement.Resource:
                        _resources.Add(new ResourceElementReadWrite(reader, schemaVersion));
                        break;

                    case Consts.ContextSchema.RequestElement.Action:
                        _action = new ActionElementReadWrite(reader, schemaVersion);
                        break;

                    case Consts.ContextSchema.RequestElement.Environment:
                        _environment = new EnvironmentElementReadWrite(reader, schemaVersion);
                        break;
                    }
                }
            }
            else
            {
                throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
            }
        }