Ejemplo n.º 1
0
        /// <summary>
        /// Builds the delegation policy path based on input policyMatch
        /// </summary>
        /// <param name="policyMatch">param to build policypath from</param>
        /// <returns>policypath matching input data</returns>
        public static string GetAltinnAppDelegationPolicyPath(PolicyMatch policyMatch)
        {
            DelegationHelper.TryGetResourceFromAttributeMatch(policyMatch.Resource, out string org, out string app);
            DelegationHelper.GetCoveredByFromMatch(policyMatch.CoveredBy, out int?coveredByUserId, out int?coveredByPartyId);

            return(PolicyHelper.GetAltinnAppDelegationPolicyPath(org, app, policyMatch.OfferedByPartyId.ToString(), coveredByUserId, coveredByPartyId));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the delegation policy path for a single Rule
        /// </summary>
        /// <returns>A bool indicating whether necessary params to build the path where found</returns>
        public static bool TryGetDelegationPolicyPathFromRule(Rule rule, out string delegationPolicyPath)
        {
            delegationPolicyPath = null;
            if (TryGetDelegationParamsFromRule(rule, out string org, out string app, out int offeredBy, out int?coveredByPartyId, out int?coveredByUserId, out _))
            {
                delegationPolicyPath = PolicyHelper.GetAltinnAppDelegationPolicyPath(org, app, offeredBy.ToString(), coveredByUserId, coveredByPartyId);
                return(true);
            }

            return(false);
        }