Example #1
0
        /// <summary>
        /// Creates a new Result using the provided information.
        /// </summary>
        /// <param name="resourceId">The resource id for this result.</param>
        /// <param name="decision">The decission of the evaluation.</param>
        /// <param name="status">The status with information about the execution.</param>
        /// <param name="obligations">The list of obligations</param>
        /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
        public ResultElement(string resourceId, Decision decision, StatusElement status, ObligationCollection obligations, XacmlVersion schemaVersion)
            : base(XacmlSchema.Context, schemaVersion)
        {
            _resourceId = resourceId;
            Decision    = decision;

            // If the status is null, create an empty status
            Status = status ?? new StatusElement(null, null, null, schemaVersion);

            // If the obligations are null, leave the empty ObligationCollection.
            if (obligations != null)
            {
                _obligations = obligations;
            }
        }
Example #2
0
        /// <summary>
        /// Creates a new Result using the provided information.
        /// </summary>
        /// <param name="resourceId">The resource id for this result.</param>
        /// <param name="decision">The decission of the evaluation.</param>
        /// <param name="status">The status with information about the execution.</param>
        /// <param name="obligations">The list of obligations</param>
        /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
        public ResultElement(string resourceId, Decision decision, StatusElement status, ObligationCollection obligations, XacmlVersion schemaVersion)
            : base(XacmlSchema.Context, schemaVersion)
        {
            _resourceId = resourceId;
            Decision = decision;

            // If the status is null, create an empty status
            Status = status ?? new StatusElement(null, null, null, schemaVersion);

            // If the obligations are null, leave the empty ObligationCollection.
            if (obligations != null)
            {
                _obligations = obligations;
            }
        }
Example #3
0
        /// <summary>
        /// Process the obligations for the policy.
        /// </summary>
        /// <param name="context">The evaluation context instance.</param>
        private void ProcessObligations(EvaluationContext context)
        {
            _obligations = new ObligationCollection();
            if (_evaluationValue != Decision.Indeterminate &&
                _evaluationValue != Decision.NotApplicable &&
                _policySet.Obligations != null &&
                _policySet.Obligations.Count != 0)
            {
                foreach (ObligationElement obl in _policySet.Obligations)
                {
                    if ((obl.FulfillOn == Effect.Deny && _evaluationValue == Decision.Deny) ||
                        (obl.FulfillOn == Effect.Permit && _evaluationValue == Decision.Permit))
                    {
                        context.Trace("Adding obligation: {0} ", obl.ObligationId);
                        _obligations.Add(obl);
                    }
                }

                // Get all obligations from child policies
                foreach (IMatchEvaluable child in _policies)
                {
                    var oblig = child as IObligationsContainer;
                    if (oblig != null && oblig.Obligations != null)
                    {
                        foreach (ObligationElement childObligation in oblig.Obligations)
                        {
                            if ((childObligation.FulfillOn == Effect.Deny && _evaluationValue == Decision.Deny) ||
                                (childObligation.FulfillOn == Effect.Permit && _evaluationValue == Decision.Permit))
                            {
                                _obligations.Add(childObligation);
                            }
                        }
                    }
                }
            }
        }
Example #4
0
        /// <summary>
        /// Process the obligations for the policy.
        /// </summary>
        /// <param name="context">The evaluation context instance.</param>
        private void ProcessObligations(EvaluationContext context)
        {
            _obligations = new ObligationCollection();
            if (_evaluationValue != Decision.Indeterminate &&
                _evaluationValue != Decision.NotApplicable &&
                _policySet.Obligations != null &&
                _policySet.Obligations.Count != 0)
            {
                foreach (ObligationElement obl in _policySet.Obligations)
                {
                    if ((obl.FulfillOn == Effect.Deny && _evaluationValue == Decision.Deny) ||
                        (obl.FulfillOn == Effect.Permit && _evaluationValue == Decision.Permit))
                    {
                        context.Trace("Adding obligation: {0} ", obl.ObligationId);
                        _obligations.Add(obl);
                    }
                }

                // Get all obligations from child policies
                foreach (IMatchEvaluable child in _policies)
                {
                    var oblig = child as IObligationsContainer;
                    if (oblig != null && oblig.Obligations != null)
                    {
                        foreach (ObligationElement childObligation in oblig.Obligations)
                        {
                            if ((childObligation.FulfillOn == Effect.Deny && _evaluationValue == Decision.Deny) ||
                                (childObligation.FulfillOn == Effect.Permit && _evaluationValue == Decision.Permit))
                            {
                                _obligations.Add(childObligation);
                            }
                        }
                    }
                }
            }
        }