예제 #1
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));
     }
 }
예제 #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;
 }
예제 #3
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;
 }
예제 #4
0
파일: Action.cs 프로젝트: zszqwe/anycmd
        /// <summary>
        ///
        /// </summary>
        /// <param name="action"></param>
        public Action(con.ActionElementReadWrite action)
        {
            _action = action;

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

            foreach (con.AttributeElementReadWrite attr in _action.Attributes)
            {
                this.Nodes.Add(new Attribute(attr));
            }
        }
예제 #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="action"></param>
        public Action( con.ActionElementReadWrite action )
        {
            _action = action;

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

            foreach( con.AttributeElementReadWrite attr in _action.Attributes )
            {
                this.Nodes.Add( new Attribute( attr ) );
            }
        }
예제 #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));
            }
        }