Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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>();
        }
Exemplo n.º 3
0
        private bool MatchesAction(string requestedAction)
        {
            if (Action == "manage") //--> Statics (Const) || Enum?
            {
                return(true);
            }

            return(Action == actionCleaner.Clean(requestedAction));
        }
Exemplo n.º 4
0
        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>();
        }
Exemplo n.º 5
0
        private bool Matches(string action)
        {
            var requestedAction = actionCleaner.Clean(action);

            return(Regex.IsMatch(requestedAction, AllowedAction, RegexOptions.IgnoreCase));
        }
Exemplo n.º 6
0
 public TypedPermission(string action, Func <T, bool> predicate, ActionCleaner actionCleaner)
 {
     AllowedAction      = actionCleaner.Clean(action);
     this.predicate     = predicate;
     this.actionCleaner = actionCleaner;
 }