public Transition AllowInitiatorOnly(Tt t) { Trigger = t; AllowRoles.Clear(); AllowRoles.Add(Workflow.CurrentState.Initiator); return(this); }
public Transition Allow(List <Tr> roles, Tt t) { Trigger = t; AllowRoles.Clear(); foreach (var r in roles) { AllowRoles.Add(r); } return(this); }
public Transition AllowAll(Tt t) { Trigger = t; AllowRoles.Clear(); foreach (var r in Enum.GetValues(typeof(Tr))) { AllowRoles.Add((Tr)r); } return(this); }
public bool IsAllowed(ClaimsPrincipal claim) { if (Public || claim.IsInRole("admin") || Owner.Equals(claim.Identity.Name)) { return(true); } if (DenyUsers.Contains(claim.Identity.Name)) { return(false); } if (AllowUsers.Contains(claim.Identity.Name)) { return(true); } return(!DenyRoles.Any(claim.IsInRole) && AllowRoles.Any(claim.IsInRole)); }
public bool CanInvoke(Tr tr, Tt tt) { if (AllowRoles.Contains(tr) && Trigger.GetHashCode() == tt.GetHashCode()) { if (GuardCondition == null) { return(true); } else if (GuardCondition != null && GuardCondition(tr)) { return(true); } else { return(false); } } return(false); }
public IEnumerable <string> GetAllowableRolesAndUsersCombined() { return(AllowRoles.Concat(AllowUsers)); }
public Transition Allow(Tr r, Tt t) { AllowRoles.Add(r); Trigger = t; return(this); }