Esempio n. 1
0
        private void CreateResourceAttributeDesignator(object sender, EventArgs args)
        {
            ResourceAttributeDesignatorElement att = new ResourceAttributeDesignatorElement(string.Empty, false, "TODO: Add attribute id", string.Empty, Xacml.XacmlVersion.Version11);

            TreeNodes.AttributeDesignator node = new TreeNodes.AttributeDesignator(att);

            tvwCondition.Nodes.Add(node);
            _condition.Arguments.Add(att);
        }
Esempio n. 2
0
 private void tvwCondition_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
 {
     if (e.Node is TreeNodes.FunctionExecution)
     {
         grpElement.Text = "Function execution";
         TreeNodes.FunctionExecution node = (TreeNodes.FunctionExecution)e.Node;
         txtValue.Visible                   = false;
         cmbInternalFunctions.Visible       = true;
         cmbInternalFunctions.SelectedIndex = cmbInternalFunctions.FindStringExact(node.ApplyBaseDefinition.FunctionId);
         label2.Text         = "FunctionId:";
         cmbDataType.Enabled = false;
     }
     else if (e.Node is TreeNodes.FunctionParameter)
     {
         grpElement.Text = "Function parameter";
         TreeNodes.FunctionParameter node = (TreeNodes.FunctionParameter)e.Node;
         txtValue.Visible                   = false;
         cmbInternalFunctions.Visible       = true;
         cmbInternalFunctions.SelectedIndex = cmbInternalFunctions.FindStringExact(node.FunctionDefinition.FunctionId);
         label2.Text         = "FunctionId:";
         cmbDataType.Enabled = false;
     }
     else if (e.Node is TreeNodes.AttributeValue)
     {
         grpElement.Text = "Attribute value";
         TreeNodes.AttributeValue node = (TreeNodes.AttributeValue)e.Node;
         txtValue.Visible             = true;
         cmbInternalFunctions.Visible = false;
         txtValue.Text             = node.AttributeValueDefinition.Contents;
         label2.Text               = "Value:";
         cmbDataType.Enabled       = true;
         cmbDataType.SelectedIndex = cmbDataType.FindStringExact(node.AttributeValueDefinition.DataType);
     }
     else if (e.Node is TreeNodes.AttributeDesignator)
     {
         grpElement.Text = "Attribute designator";
         TreeNodes.AttributeDesignator node = (TreeNodes.AttributeDesignator)e.Node;
         txtValue.Visible             = true;
         cmbInternalFunctions.Visible = false;
         txtValue.Text             = node.AttributeDesignatorDefinition.AttributeId;
         label2.Text               = "AttributeId:";
         cmbDataType.Enabled       = true;
         cmbDataType.SelectedIndex = cmbDataType.FindStringExact(node.AttributeDesignatorDefinition.DataType);
     }
     else if (e.Node is TreeNodes.AttributeSelector)
     {
         grpElement.Text = "Attribute selector";
         TreeNodes.AttributeSelector node = (TreeNodes.AttributeSelector)e.Node;
         txtValue.Visible             = true;
         cmbInternalFunctions.Visible = false;
         txtValue.Text       = node.AttributeSelectorDefinition.RequestContextPath;
         label2.Text         = "XPath:";
         cmbDataType.Enabled = false;
     }
 }
Esempio n. 3
0
        private void CreateResourceAttributeDesignatorFromFunction(object sender, EventArgs args)
        {
            TreeNodes.FunctionExecution func        = (TreeNodes.FunctionExecution)tvwCondition.SelectedNode;
            pol.ApplyBaseReadWrite      parentApply = func.ApplyBaseDefinition;

            ResourceAttributeDesignatorElement att = new ResourceAttributeDesignatorElement(string.Empty, false, "TODO: Add attribute id", string.Empty, Xacml.XacmlVersion.Version11);

            TreeNodes.AttributeDesignator node = new TreeNodes.AttributeDesignator(att);

            func.Nodes.Add(node);
            parentApply.Arguments.Add(att);
        }
Esempio n. 4
0
        private void mniDelete_Click(object sender, System.EventArgs e)
        {
            TreeNodes.FunctionExecution functionNode = (TreeNodes.FunctionExecution)tvwCondition.SelectedNode.Parent;

            TreeNodes.NoBoldNode node = (TreeNodes.NoBoldNode)tvwCondition.SelectedNode;

            if (node is TreeNodes.FunctionExecution)
            {
                TreeNodes.FunctionExecution funcNode = ((TreeNodes.FunctionExecution)node);
                int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex((pol.ApplyElement)funcNode.ApplyBaseDefinition);
                functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index);
                functionNode.Nodes.Remove(funcNode);
            }
            else if (node is TreeNodes.FunctionParameter)
            {
                TreeNodes.FunctionParameter funcNode = ((TreeNodes.FunctionParameter)node);
                int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(funcNode.FunctionDefinition);
                functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index);
                functionNode.Nodes.Remove(funcNode);
            }
            else if (node is TreeNodes.AttributeValue)
            {
                TreeNodes.AttributeValue attNode = ((TreeNodes.AttributeValue)node);
                int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(attNode.AttributeValueDefinition);
                functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index);
                functionNode.Nodes.Remove(attNode);
            }
            else if (node is TreeNodes.AttributeDesignator)
            {
                TreeNodes.AttributeDesignator attNode = ((TreeNodes.AttributeDesignator)node);
                int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(attNode.AttributeDesignatorDefinition);
                functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index);
                functionNode.Nodes.Remove(attNode);
            }
            else if (node is TreeNodes.AttributeSelector)
            {
                TreeNodes.AttributeSelector attNode = ((TreeNodes.AttributeSelector)node);
                int index = functionNode.ApplyBaseDefinition.Arguments.GetIndex(attNode.AttributeSelectorDefinition);
                functionNode.ApplyBaseDefinition.Arguments.RemoveAt(index);
                functionNode.Nodes.Remove(attNode);
            }
        }
Esempio n. 5
0
        private void tvwCondition_BeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
        {
            TreeNodes.NoBoldNode node = (TreeNodes.NoBoldNode)tvwCondition.SelectedNode;

            if (node is TreeNodes.FunctionExecution)
            {
                TreeNodes.FunctionExecution funcNode = ((TreeNodes.FunctionExecution)node);
                funcNode.ApplyBaseDefinition.FunctionId = cmbInternalFunctions.Text;
                tvwCondition.SelectedNode      = funcNode;
                tvwCondition.SelectedNode.Text = "[" + "dataType" + "] " + funcNode.ApplyBaseDefinition.FunctionId;
            }
            else if (node is TreeNodes.FunctionParameter)
            {
                TreeNodes.FunctionParameter funcNode = ((TreeNodes.FunctionParameter)node);
                funcNode.FunctionDefinition.FunctionId = cmbInternalFunctions.Text;
                tvwCondition.SelectedNode      = funcNode;
                tvwCondition.SelectedNode.Text = "Function: " + funcNode.FunctionDefinition.FunctionId;;
            }
            else if (node is TreeNodes.AttributeValue)
            {
                TreeNodes.AttributeValue attNode = ((TreeNodes.AttributeValue)node);
                attNode.AttributeValueDefinition.Value    = txtValue.Text;
                attNode.AttributeValueDefinition.DataType = cmbDataType.Text;
                tvwCondition.SelectedNode      = attNode;
                tvwCondition.SelectedNode.Text = "[" + attNode.AttributeValueDefinition.DataType + "] " + attNode.AttributeValueDefinition.Contents;
            }
            else if (node is TreeNodes.AttributeDesignator)
            {
                TreeNodes.AttributeDesignator attNode = ((TreeNodes.AttributeDesignator)node);
                attNode.AttributeDesignatorDefinition.AttributeId = txtValue.Text;
                attNode.AttributeDesignatorDefinition.DataType    = cmbDataType.Text;
                tvwCondition.SelectedNode      = attNode;
                tvwCondition.SelectedNode.Text = "[" + attNode.AttributeDesignatorDefinition.DataType + "]:" + attNode.AttributeDesignatorDefinition.AttributeId;
            }
            else if (node is TreeNodes.AttributeSelector)
            {
                TreeNodes.AttributeSelector attNode = ((TreeNodes.AttributeSelector)node);
                attNode.AttributeSelectorDefinition.RequestContextPath = txtValue.Text;
                tvwCondition.SelectedNode      = attNode;
                tvwCondition.SelectedNode.Text = "XPath: " + attNode.AttributeSelectorDefinition.RequestContextPath;
            }
        }
Esempio n. 6
0
        private void CreateSubjectAttributeDesignatorFromFunction( object sender, EventArgs args )
        {
            TreeNodes.FunctionExecution func = (TreeNodes.FunctionExecution)tvwCondition.SelectedNode;
            pol.ApplyBaseReadWrite parentApply = func.ApplyBaseDefinition;

            SubjectAttributeDesignatorElement att = new SubjectAttributeDesignatorElement( string.Empty, false, "TODO: Add attribute id", string.Empty, string.Empty ,Xacml.XacmlVersion.Version11 );
            TreeNodes.AttributeDesignator node = new TreeNodes.AttributeDesignator( att );

            func.Nodes.Add( node );
            parentApply.Arguments.Add( att );
        }
Esempio n. 7
0
        private void CreateSubjectAttributeDesignator( object sender, EventArgs args )
        {
            SubjectAttributeDesignatorElement att = new SubjectAttributeDesignatorElement( string.Empty, false, "TODO: Add attribute id", string.Empty, string.Empty ,Xacml.XacmlVersion.Version11 );
            TreeNodes.AttributeDesignator node = new TreeNodes.AttributeDesignator( att );

            tvwCondition.Nodes.Add( node );
            _condition.Arguments.Add( att );
        }