Пример #1
0
        public async Task <IEnumerable <EvaluateResult> > Evaluate(IEnumerable <Guid> entitiesId, Guid permission)
        {
            if (!UseAuthorization ||
                _securityContext.IsAdministrator())
            {
                return(entitiesId
                       .Select(x => new EvaluateResult(x, permission, true, null)));
            }

            var appliableSubjects = _securityContext.GetApplyableSubjects();

            var rules = await _rulesFinder.GetRules(entitiesId, appliableSubjects, permission);

            return(rules
                   .Select(x => _rulesMatcher.EvaluateRule(x.Node, x.Rules, permission))
                   .ToList());
        }