/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstMatch_SelectedIndexChanged(object sender, EventArgs e) { if (lstMatch.SelectedItem != null) { if (index != -1 && index != lstMatch.SelectedIndex) { pol.TargetMatchBaseReadWrite indexMatch = lstMatch.Items[index] as pol.TargetMatchBaseReadWrite; lstMatch.Items.RemoveAt(index); lstMatch.Items.Insert(index, indexMatch); } pol.TargetMatchBaseReadWrite match = lstMatch.SelectedItem as pol.TargetMatchBaseReadWrite; index = lstMatch.SelectedIndex; try { LoadingData = true; Match matchControl = _list[lstMatch.SelectedIndex] as Match; if (matchControl == null) { matchControl = new Match(_targetItem, match, lstMatch.SelectedIndex); _list[lstMatch.SelectedIndex] = matchControl; } mainPanel.Controls.Clear(); mainPanel.Controls.Add(matchControl); } finally { LoadingData = false; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { pol.TargetMatchBaseReadWrite targetMatch = null; if (_targetItem is pol.ActionElementReadWrite) { targetMatch = new pol.ActionMatchElementReadWrite( InternalFunctions.StringEqual, new pol.AttributeValueElementReadWrite(InternalDataTypes.XsdString, "Somebody", XacmlVersion.Version11), //TODO: check version new pol.ActionAttributeDesignatorElement(InternalDataTypes.XsdString, false, "", "", XacmlVersion.Version11), //TODO: check version XacmlVersion.Version11); } else if (_targetItem is pol.EnvironmentElementReadWrite) { targetMatch = new pol.EnvironmentMatchElementReadWrite( InternalFunctions.StringEqual, new pol.AttributeValueElementReadWrite(InternalDataTypes.XsdString, "Somebody", XacmlVersion.Version11), //TODO: check version new pol.EnvironmentAttributeDesignatorElement(InternalDataTypes.XsdString, false, "", "", XacmlVersion.Version11), //TODO: check version XacmlVersion.Version11); } else if (_targetItem is pol.ResourceElementReadWrite) { targetMatch = new pol.ResourceMatchElementReadWrite( InternalFunctions.StringEqual, new pol.AttributeValueElementReadWrite(InternalDataTypes.XsdString, "Somebody", XacmlVersion.Version11), //TODO: check version new pol.ResourceAttributeDesignatorElement(InternalDataTypes.XsdString, false, "", "", XacmlVersion.Version11), //TODO: check version XacmlVersion.Version11); } else if (_targetItem is pol.SubjectElementReadWrite) { targetMatch = new pol.SubjectMatchElementReadWrite( InternalFunctions.StringEqual, new pol.AttributeValueElementReadWrite(InternalDataTypes.XsdString, "Somebody", XacmlVersion.Version11), //TODO: check version new pol.SubjectAttributeDesignatorElement(InternalDataTypes.XsdString, false, "", "", "", XacmlVersion.Version11), //TODO: check version XacmlVersion.Version11); } _targetItem.Match.Add(targetMatch); //TODO: check version try { LoadingData = true; Match matchControl = new Match(_targetItem, targetMatch, lstMatch.Items.Count); _list[lstMatch.Items.Count] = matchControl; } finally { LoadingData = false; } index = -1; lstMatch.Items.Clear(); foreach (pol.TargetMatchBaseReadWrite match in _targetItem.Match) { lstMatch.Items.Add(match); } }
/// <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(TargetMatchBaseReadWrite value) { return (List.Add((TargetMatchBase)value)); }
/// <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(TargetMatchBaseReadWrite value) { return(List.Add(value)); }
/// <summary> /// /// </summary> /// <param name="targetItem"></param> /// <param name="match"></param> /// <param name="index"></param> public Match( pol.TargetItemBaseReadWrite targetItem, pol.TargetMatchBaseReadWrite match, int index ) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); LoadingData = true; foreach( FieldInfo field in typeof(InternalDataTypes).GetFields() ) { cmbASDataType.Items.Add( field.GetValue( null ) ); cmbADDataType.Items.Add( field.GetValue( null ) ); cmbAVDataType.Items.Add( field.GetValue( null ) ); } foreach( FieldInfo field in typeof(InternalFunctions).GetFields() ) { cmbFunctions.Items.Add( field.GetValue( null ) ); } txtSubjectCategory.Visible = false; lblSubjectCategory.Visible = false; _match = match; _index = index; if( targetItem is pol.ActionElementReadWrite ) { _targetItemName = "Action"; } else if( targetItem is pol.SubjectElementReadWrite ) { _targetItemName = "Subject"; txtSubjectCategory.Visible = true; lblSubjectCategory.Visible = true; } else if( targetItem is pol.ResourceElementReadWrite ) { _targetItemName = "Resource"; } grpMatch.Text = _targetItemName + "Match"; cmbFunctions.SelectedIndex = cmbFunctions.FindStringExact( _match.MatchId ); cmbFunctions.DataBindings.Add( "SelectedItem", _match, "MatchId" ); cmbAVDataType.SelectedIndex = cmbAVDataType.FindStringExact( match.AttributeValue.DataType ); cmbAVDataType.DataBindings.Add( "SelectedItem", _match.AttributeValue, "DataType" ); txtAttributeValue.Text = match.AttributeValue.Contents; txtAttributeValue.DataBindings.Add( "Text", _match.AttributeValue, "Contents" ); if( match.AttributeReference is pol.AttributeDesignatorBase ) { rdbAttributeDesignator.Checked = true; rdbAttributeSelector.Checked = false; cmbADDataType.SelectedIndex = cmbADDataType.FindStringExact( match.AttributeReference.DataType ); cmbADDataType.DataBindings.Add( "SelectedItem", _match.AttributeReference, "DataType" ); chkADMustBePresent.Checked = match.AttributeReference.MustBePresent; chkADMustBePresent.DataBindings.Add( "Checked", _match.AttributeReference, "MustBePresent" ); pol.AttributeDesignatorBase attributeDesignator = (pol.AttributeDesignatorBase)match.AttributeReference; txtAttributeId.Text = attributeDesignator.AttributeId; txtAttributeId.DataBindings.Add( "Text", _match.AttributeReference, "AttributeId" ); txtIssuer.Text = attributeDesignator.Issuer; txtIssuer.DataBindings.Add( "Text", _match.AttributeReference, "Issuer" ); } else if( match.AttributeReference is pol.AttributeSelectorElement ) { rdbAttributeDesignator.Checked = false; rdbAttributeSelector.Checked = true; cmbASDataType.SelectedIndex = cmbASDataType.FindStringExact( match.AttributeReference.DataType ); cmbASDataType.DataBindings.Add( "SelectedItem", _match.AttributeReference, "DataType" ); chkASMustBePresent.Checked = match.AttributeReference.MustBePresent; chkASMustBePresent.DataBindings.Add( "Checked", _match.AttributeReference, "MustBePresent" ); txtRequestContextPath.Text = ((pol.AttributeSelectorElement)match.AttributeReference).RequestContextPath; txtRequestContextPath.DataBindings.Add( "Text", _match.AttributeReference, "RequestContextPath" ); } LoadingData = false; }
/// <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(TargetMatchBaseReadWrite value) { return(List.Add((TargetMatchBase)value)); }
/// <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( TargetMatchBaseReadWrite value ) { return( List.Add( value ) ); }
/// <summary> /// /// </summary> /// <param name="targetItem"></param> /// <param name="match"></param> /// <param name="index"></param> public Match(pol.TargetItemBaseReadWrite targetItem, pol.TargetMatchBaseReadWrite match, int index) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); LoadingData = true; foreach (FieldInfo field in typeof(InternalDataTypes).GetFields()) { cmbASDataType.Items.Add(field.GetValue(null)); cmbADDataType.Items.Add(field.GetValue(null)); cmbAVDataType.Items.Add(field.GetValue(null)); } foreach (FieldInfo field in typeof(InternalFunctions).GetFields()) { cmbFunctions.Items.Add(field.GetValue(null)); } txtSubjectCategory.Visible = false; lblSubjectCategory.Visible = false; _match = match; _index = index; if (targetItem is pol.ActionElementReadWrite) { _targetItemName = "Action"; } else if (targetItem is pol.SubjectElementReadWrite) { _targetItemName = "Subject"; txtSubjectCategory.Visible = true; lblSubjectCategory.Visible = true; } else if (targetItem is pol.ResourceElementReadWrite) { _targetItemName = "Resource"; } grpMatch.Text = _targetItemName + "Match"; cmbFunctions.SelectedIndex = cmbFunctions.FindStringExact(_match.MatchId); cmbFunctions.DataBindings.Add("SelectedItem", _match, "MatchId"); cmbAVDataType.SelectedIndex = cmbAVDataType.FindStringExact(match.AttributeValue.DataType); cmbAVDataType.DataBindings.Add("SelectedItem", _match.AttributeValue, "DataType"); txtAttributeValue.Text = match.AttributeValue.Contents; txtAttributeValue.DataBindings.Add("Text", _match.AttributeValue, "Contents"); if (match.AttributeReference is pol.AttributeDesignatorBase) { rdbAttributeDesignator.Checked = true; rdbAttributeSelector.Checked = false; cmbADDataType.SelectedIndex = cmbADDataType.FindStringExact(match.AttributeReference.DataType); cmbADDataType.DataBindings.Add("SelectedItem", _match.AttributeReference, "DataType"); chkADMustBePresent.Checked = match.AttributeReference.MustBePresent; chkADMustBePresent.DataBindings.Add("Checked", _match.AttributeReference, "MustBePresent"); pol.AttributeDesignatorBase attributeDesignator = (pol.AttributeDesignatorBase)match.AttributeReference; txtAttributeId.Text = attributeDesignator.AttributeId; txtAttributeId.DataBindings.Add("Text", _match.AttributeReference, "AttributeId"); txtIssuer.Text = attributeDesignator.Issuer; txtIssuer.DataBindings.Add("Text", _match.AttributeReference, "Issuer"); } else if (match.AttributeReference is pol.AttributeSelectorElement) { rdbAttributeDesignator.Checked = false; rdbAttributeSelector.Checked = true; cmbASDataType.SelectedIndex = cmbASDataType.FindStringExact(match.AttributeReference.DataType); cmbASDataType.DataBindings.Add("SelectedItem", _match.AttributeReference, "DataType"); chkASMustBePresent.Checked = match.AttributeReference.MustBePresent; chkASMustBePresent.DataBindings.Add("Checked", _match.AttributeReference, "MustBePresent"); txtRequestContextPath.Text = ((pol.AttributeSelectorElement)match.AttributeReference).RequestContextPath; txtRequestContextPath.DataBindings.Add("Text", _match.AttributeReference, "RequestContextPath"); } LoadingData = false; }