Beispiel #1
0
        private int OnProcessingSequence(IPfcNode node1, IPfcNode node2)
        {
            // Must process parallel convergences last.
            InputRole ir1 = GetValidationData(node1).InputRole;
            InputRole ir2 = GetValidationData(node2).InputRole;

            if (ir1 == InputRole.ParallelConvergence && ir2 != InputRole.ParallelConvergence)
            {
                return(1);
            }
            if (ir1 != InputRole.ParallelConvergence && ir2 == InputRole.ParallelConvergence)
            {
                return(-1);
            }
            if (Node1DependsOnNode2(node1, node2))
            {
                return(1);
            }
            else if (Node1DependsOnNode2(node2, node1))
            {
                return(-1);
            }
            else
            {
                return(-Comparer.Default.Compare(node2.GraphOrdinal, node1.GraphOrdinal));
            }
        }
Beispiel #2
0
        public async Task <ActionResult> IsRole(
            InputRole input
            )
        {
            if (!ModelState.IsValid | User == null)
            {
                return(BadRequest());
            }
            var arRoles = input.RoleName.Split(",");
            var user    = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(NotFound());
            }
            foreach (var item in arRoles)
            {
                var re = await _userManager.IsInRoleAsync(user, input.RoleName);

                if (!re)
                {
                    return(Forbid());
                }
            }
            return(Ok());
        }