public IActionResult ChangeUnsureSave( [FromServices] IRoleBasedPermissionRuleRepository checkFeatureRuleRepository, [FromServices] IPermissionRuleActionPoolService poolService, [FromServices] IPermissionRuleActionPool pool, string mode = null) { var checkFeatureRules = checkFeatureRuleRepository.GetRules(); var checkFeatureRule = checkFeatureRules.GetRule(KnownPermissionIds.UnsureOp, false); if (checkFeatureRule != null) { if ("guestAllowed".Equals(mode, StringComparison.OrdinalIgnoreCase)) { checkFeatureRule.SetNeedGuest(); } if ("loginAllowed".Equals(mode, StringComparison.OrdinalIgnoreCase)) { checkFeatureRule.SetNeedLogin(); } if ("adminAllowed".Equals(mode, StringComparison.OrdinalIgnoreCase)) { checkFeatureRule.SetNeedUsersOrRoles("", "Admin"); } checkFeatureRuleRepository.Save(); poolService.RefreshPool(pool); } return(RedirectToAction("Unsure", "Simple")); }
public void SetRuleActions(IPermissionRuleActionPool ruleActionPool) { var rules = _ruleRepository.GetRules(); var actions = _actionRepository.GetActions(); ruleActionPool.SetRoleBasedPermissionRules(rules.Values, true); ruleActionPool.SetDynamicCheckActions(actions, true); }