Exemplo n.º 1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="attribute"></param>
		public Attribute( con.AttributeElementReadWrite attribute )
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			LoadingData = true;

			_attribute = attribute;

			foreach( FieldInfo field in typeof(InternalDataTypes).GetFields() )
			{
				cmbDataType.Items.Add( field.GetValue( null ) );
			}

			this.lstAttributeValue.DisplayMember = "Value";
			
			foreach( con.AttributeValueElementReadWrite attr in _attribute.AttributeValues )
			{
				lstAttributeValue.Items.Add( attr );
			}

			if( _attribute.AttributeValues.Count != 0 )
			{
				lstAttributeValue.SelectedIndex = 0;
			}

			txtId.Text = _attribute.AttributeId;
			txtId.DataBindings.Add( "Text", _attribute, "AttributeId" );
			txtIssuer.Text = _attribute.Issuer;
			//txtIssuer.DataBindings.Add( "Text", _attribute, "Issuer" );
			cmbDataType.SelectedIndex = cmbDataType.FindStringExact( _attribute.DataType);
			cmbDataType.DataBindings.Add( "SelectedItem", _attribute, "DataType" );
			LoadingData = false;
		}
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="attribute"></param>
        public Attribute(con.AttributeElementReadWrite attribute)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            LoadingData = true;

            _attribute = attribute;

            foreach (FieldInfo field in typeof(InternalDataTypes).GetFields())
            {
                cmbDataType.Items.Add(field.GetValue(null));
            }

            this.lstAttributeValue.DisplayMember = "Value";

            foreach (con.AttributeValueElementReadWrite attr in _attribute.AttributeValues)
            {
                lstAttributeValue.Items.Add(attr);
            }

            if (_attribute.AttributeValues.Count != 0)
            {
                lstAttributeValue.SelectedIndex = 0;
            }

            txtId.Text = _attribute.AttributeId;
            txtId.DataBindings.Add("Text", _attribute, "AttributeId");
            txtIssuer.Text = _attribute.Issuer;
            //txtIssuer.DataBindings.Add( "Text", _attribute, "Issuer" );
            cmbDataType.SelectedIndex = cmbDataType.FindStringExact(_attribute.DataType);
            cmbDataType.DataBindings.Add("SelectedItem", _attribute, "DataType");
            LoadingData = false;
        }
Exemplo n.º 3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="attribute"></param>
		public Attribute( con.AttributeElementReadWrite attribute )
		{
			_attribute = attribute;

			this.Text = "Attribute";
			this.SelectedImageIndex = 3;
			this.ImageIndex = 3;
		}
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="attribute"></param>
        public Attribute(con.AttributeElementReadWrite attribute)
        {
            _attribute = attribute;

            this.Text = "Attribute";
            this.SelectedImageIndex = 3;
            this.ImageIndex         = 3;
        }
Exemplo n.º 5
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(AttributeElementReadWrite value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     return(List.Add(new AttributeElement(value.AttributeId, value.DataType, value.Issuer, value.IssueInstant, value.Value,
                                          value.SchemaVersion)));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets the index of the given AttributeElementReadWrite in the collection
 /// </summary>
 /// <param name="attribute"></param>
 /// <returns></returns>
 public int GetIndex(AttributeElementReadWrite attribute)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this.List[i] == attribute)
         {
             return(i);
         }
     }
     return(-1);
 }
 /// <summary>
 /// Clones an Attribute from another attribute.
 /// </summary>
 /// <param name="attributeElement">The attribute id.</param>
 public AttributeElementReadWrite(AttributeElementReadWrite attributeElement)
     : base(XacmlSchema.Context, attributeElement.SchemaVersion)
 {
     if (attributeElement == null)
     {
         throw new ArgumentNullException("attributeElement");
     }
     _attributeId  = attributeElement._attributeId;
     _dataType     = attributeElement._dataType;
     _issuer       = attributeElement._issuer;
     _issueInstant = attributeElement._issueInstant;
     foreach (AttributeValueElementReadWrite avalue in attributeElement._attributeValues)
     {
         _attributeValues.Add(new AttributeValueElementReadWrite(avalue));
     }
 }
		/// <summary>
		/// Gets the index of the given AttributeElementReadWrite in the collection
		/// </summary>
		/// <param name="attribute"></param>
		/// <returns></returns>
		public int GetIndex( AttributeElementReadWrite attribute )
		{
			for( int i=0; i<this.Count; i++ )
			{
				if( this.List[i] == attribute )
				{
					return i;
				}
			}
			return -1;
		}
		/// <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 virtual int Add( AttributeElementReadWrite value )  
		{
			return( List.Add( value ) );
		}
Exemplo n.º 10
0
		/// <summary>
		/// Clones an Attribute from another attribute.
		/// </summary>
		/// <param name="attributeElement">The attribute id.</param>
		public AttributeElementReadWrite( AttributeElementReadWrite attributeElement )
			: base( XacmlSchema.Context, attributeElement.SchemaVersion )
		{
            if (attributeElement == null) throw new ArgumentNullException("attributeElement");
			_attributeId = attributeElement._attributeId;
			_dataType = attributeElement._dataType;
			_issuer = attributeElement._issuer;
			_issueInstant = attributeElement._issueInstant;
			foreach( AttributeValueElementReadWrite avalue in attributeElement._attributeValues )
			{
				_attributeValues.Add( new AttributeValueElementReadWrite( avalue ) );
			}
			
		}
Exemplo n.º 11
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( AttributeElementReadWrite value )  
		{
            if (value == null) throw new ArgumentNullException("value");
			return( List.Add( new AttributeElement( value.AttributeId, value.DataType, value.Issuer, value.IssueInstant, value.Value, 
				value.SchemaVersion) ) );
		}
Exemplo n.º 12
0
		private void CreateContextAttributeElement( object sender, EventArgs args )
		{
			NoBoldNode node = (NoBoldNode)mainTree.SelectedNode;

			if( node is ContextTreeNodes.Action )
			{
				ContextTreeNodes.Action actionNode = (ContextTreeNodes.Action)mainTree.SelectedNode;
				con.ActionElementReadWrite action = actionNode.ActionDefinition;
				con.AttributeElementReadWrite attribute = new con.AttributeElementReadWrite( string.Empty, string.Empty, string.Empty,
					string.Empty, "TODO: Add value", XacmlVersion.Version11);
				Attribute attributeNode = new Attribute( attribute );

				action.Attributes.Add( attribute );
				actionNode.Nodes.Add( attributeNode );
			}
			else if( node is Resource )
			{
				Resource resourceNode = (Resource)mainTree.SelectedNode;
				con.ResourceElementReadWrite resource = resourceNode.ResourceDefinition;
				con.AttributeElementReadWrite attribute = new con.AttributeElementReadWrite( string.Empty, string.Empty, string.Empty,
					string.Empty, "TODO: Add value", XacmlVersion.Version11);
				Attribute attributeNode = new Attribute( attribute );

				resource.Attributes.Add( attribute );
				resourceNode.Nodes.Add( attributeNode );
			}
			else if( node is Subject )
			{
				Subject subjectNode = (Subject)mainTree.SelectedNode;
				con.SubjectElementReadWrite subject = subjectNode.SubjectDefinition;
				con.AttributeElementReadWrite attribute = new con.AttributeElementReadWrite( "urn:new_attribute", string.Empty, string.Empty,
					string.Empty, "TODO: Add value", XacmlVersion.Version11);
				Attribute attributeNode = new Attribute( attribute );

				subject.Attributes.Add( attribute );
				subjectNode.Nodes.Add( attributeNode );
			}
		}
Exemplo n.º 13
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 virtual int Add(AttributeElementReadWrite value)
 {
     return(List.Add(value));
 }