Пример #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));
        }
Пример #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>();
        }
Пример #3
0
        private bool MatchesAction(string requestedAction)
        {
            if (Action == "manage") //--> Statics (Const) || Enum?
            {
                return(true);
            }

            return(Action == actionCleaner.Clean(requestedAction));
        }
Пример #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>();
        }
Пример #5
0
        private bool Matches(string action)
        {
            var requestedAction = actionCleaner.Clean(action);

            return(Regex.IsMatch(requestedAction, AllowedAction, RegexOptions.IgnoreCase));
        }
Пример #6
0
 public TypedPermission(string action, Func <T, bool> predicate, ActionCleaner actionCleaner)
 {
     AllowedAction      = actionCleaner.Clean(action);
     this.predicate     = predicate;
     this.actionCleaner = actionCleaner;
 }