private bool Matches(string action, object subject) { var requestedSubject = subjectCleaner.Clean(subject); var requestedAction = actionCleaner.Clean(action); return(Regex.IsMatch(requestedSubject, AllowedSubject, RegexOptions.IgnoreCase) && Regex.IsMatch(requestedAction, AllowedAction, RegexOptions.IgnoreCase)); }
public StringBasedPermission(string action, string subject, ActionCleaner actionCleaner, SubjectCleaner subjectCleaner) { this.actionCleaner = actionCleaner; this.subjectCleaner = subjectCleaner; AllowedAction = actionCleaner.Clean(action); AllowedSubject = subjectCleaner.Clean(subject); authorizationPredicates = new List <IAuthorizationPredicate>(); }
private bool MatchesAction(string requestedAction) { if (Action == "manage") //--> Statics (Const) || Enum? { return(true); } return(Action == actionCleaner.Clean(requestedAction)); }
public Permission(string action, string subject, ActionCleaner actionCleaner, SubjectCleaner subjectCleaner, IEnumerable <string> commandConventions) { this.actionCleaner = actionCleaner; this.subjectCleaner = subjectCleaner; this.commandConventions = commandConventions; Action = actionCleaner.Clean(action); Subject = subjectCleaner.Clean(subject); authorizationPredicates = new List <IAuthorizationPredicate>(); }
private bool Matches(string action) { var requestedAction = actionCleaner.Clean(action); return(Regex.IsMatch(requestedAction, AllowedAction, RegexOptions.IgnoreCase)); }
public TypedPermission(string action, Func <T, bool> predicate, ActionCleaner actionCleaner) { AllowedAction = actionCleaner.Clean(action); this.predicate = predicate; this.actionCleaner = actionCleaner; }