Exemplo n.º 1
0
 /// <summary>
 /// Gets the index of the given RuleElementReadWrite in the collection
 /// </summary>
 /// <param name="rule"></param>
 /// <returns></returns>
 public int GetIndex(RuleElementReadWrite rule)
 {
     for (int i = 0; i < this.Count; i++)
     {
         if (this.List[i] == rule)
         {
             return(i);
         }
     }
     return(-1);
 }
Exemplo n.º 2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="rule"></param>
		public Rule( pol.RuleElementReadWrite rule )
		{
			_rule = rule;

			if( _rule.Target == null )
			{
				this.Nodes.Add( new AnyTarget() );
			}
			else
			{
				this.Nodes.Add( new Target( _rule.Target ) );
			}

			if( _rule.Condition != null )
			{
				this.Nodes.Add( new Condition( _rule.Condition ) );
			}

			this.Text = string.Format( "Rule ({0})", rule.Id );
		}
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rule"></param>
        public Rule(pol.RuleElementReadWrite rule)
        {
            _rule = rule;

            if (_rule.Target == null)
            {
                this.Nodes.Add(new AnyTarget());
            }
            else
            {
                this.Nodes.Add(new Target(_rule.Target));
            }

            if (_rule.Condition != null)
            {
                this.Nodes.Add(new Condition(_rule.Condition));
            }

            this.Text = string.Format("Rule ({0})", rule.Id);
        }
Exemplo n.º 4
0
		/// <summary>
		/// 
		/// </summary>
		public Rule( pol.RuleElementReadWrite rule )
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			_rule = rule;

			LoadingData = true;

			cmbEffect.Items.Add( pol.Effect.Deny );
			cmbEffect.Items.Add( pol.Effect.Permit );

			txtDescription.Text = _rule.Description;
			txtPolicyId.Text = _rule.Id;
			cmbEffect.SelectedIndex = cmbEffect.FindStringExact( _rule.Effect.ToString() );

			txtDescription.DataBindings.Add( "Text", _rule, "Description" );
			txtPolicyId.DataBindings.Add( "Text", _rule, "Id" );
			cmbEffect.DataBindings.Add( "SelectedValue", _rule, "Effect" );

			LoadingData = false;
		}
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        public Rule(pol.RuleElementReadWrite rule)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            _rule = rule;

            LoadingData = true;

            cmbEffect.Items.Add(pol.Effect.Deny);
            cmbEffect.Items.Add(pol.Effect.Permit);

            txtDescription.Text     = _rule.Description;
            txtPolicyId.Text        = _rule.Id;
            cmbEffect.SelectedIndex = cmbEffect.FindStringExact(_rule.Effect.ToString());

            txtDescription.DataBindings.Add("Text", _rule, "Description");
            txtPolicyId.DataBindings.Add("Text", _rule, "Id");
            cmbEffect.DataBindings.Add("SelectedValue", _rule, "Effect");

            LoadingData = false;
        }
Exemplo n.º 6
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		private void CreateRule( object sender, EventArgs args )
		{
			Policy policyNode = (Policy)mainTree.SelectedNode;
			pol.PolicyElementReadWrite policy = policyNode.PolicyDefinition;

			pol.RuleElementReadWrite rule = new pol.RuleElementReadWrite(
				"urn:new_rule",
				"[TODO: add rule description]",
				null,
				null, 
				pol.Effect.Permit,
				XacmlVersion.Version11 );  //TODO: check version

			policy.Rules.Add( rule );

			Rule ruleNode = new Rule( rule );

			policyNode.Nodes.Add( ruleNode );

			ruleNode.NodeFont = new Font( mainTree.Font, FontStyle.Bold );
		}
Exemplo n.º 7
0
		/// <summary>
		/// Gets the index of the given RuleElementReadWrite in the collection
		/// </summary>
		/// <param name="rule"></param>
		/// <returns></returns>
		public int GetIndex( RuleElementReadWrite rule )
		{
			for( int i=0; i<this.Count; i++ )
			{
				if( this.List[i] == rule )
				{
					return i;
				}
			}
			return -1;
		}
Exemplo n.º 8
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( RuleElementReadWrite value )  
		{
			return( List.Add( value ) );
		}
Exemplo n.º 9
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(RuleElementReadWrite value)
 {
     return(List.Add(value));
 }