/// <summary>
 /// Method called by the EvaluationEngine when an attribute is not found.
 /// </summary>
 /// <param name="context">The evaluation context instance.</param>
 /// <param name="designator">The attribute designator.</param>
 /// <returns>An instance of an Attribute with it's value.</returns>
 public AttributeElement GetAttribute(EvaluationContext context, AttributeDesignatorBase designator)
 {
     if (context == null) throw new ArgumentNullException("context");
     if (designator == null) throw new ArgumentNullException("designator");
     foreach (var attrib in _attributes.Cast<AttributeElement>().Where(attrib => attrib.AttributeId == designator.AttributeId))
     {
         if (!string.IsNullOrEmpty(designator.Issuer))
         {
             if (designator.Issuer == attrib.Issuer)
             {
                 return attrib;
             }
         }
         else
         {
             return attrib;
         }
     }
     return null;
 }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="attributeDesignator"></param>
        public AttributeDesignator(pol.AttributeDesignatorBase attributeDesignator)
        {
            _attributeDesignator = attributeDesignator;

            this.Text = "[" + attributeDesignator.DataType + "]:" + attributeDesignator.AttributeId;
        }
예제 #3
0
파일: Match.cs 프로젝트: zszqwe/anycmd
        /// <summary>
        ///
        /// </summary>
        /// <param name="targetItem"></param>
        /// <param name="match"></param>
        /// <param name="index"></param>
        public Match(TargetItemBaseReadWrite targetItem, TargetMatchBaseReadWrite match, int index)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            LoadingData = true;

            foreach (FieldInfo field in typeof(Consts.Schema1.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(Consts.Schema1.InternalFunctions).GetFields())
            {
                cmbFunctions.Items.Add(field.GetValue(null));
            }

            txtSubjectCategory.Visible = false;
            lblSubjectCategory.Visible = false;

            _match = match;
            _index = index;

            if (targetItem is ActionElementReadWrite)
            {
                _targetItemName = "Action";
            }
            else if (targetItem is SubjectElementReadWrite)
            {
                _targetItemName            = "Subject";
                txtSubjectCategory.Visible = true;
                lblSubjectCategory.Visible = true;
            }
            else if (targetItem is 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;
        }
예제 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="attributeDesignator"></param>
        public AttributeDesignator( pol.AttributeDesignatorBase attributeDesignator )
        {
            _attributeDesignator = attributeDesignator;

            this.Text = "[" + attributeDesignator.DataType + "]:" + attributeDesignator.AttributeId;
        }