Exemplo n.º 1
0
        protected override IResult ExecuteTemplate(IManagementModelRetrieverRequest <T> req)
        {
            if (_permissions == null || _permissions.Length == 0)
            {
                return(Result.Ok);
            }

            PermisionValidate covered = _permissions.FirstOrDefault(x => req.Type == x.Operation);

            if (covered == null)
            {
                return(Result.Ok);
            }

            _userService.Validate(req.User, covered.Permission);

            return(Result.Ok);
        }
Exemplo n.º 2
0
        protected override IResult ExecuteTemplate(IManagementModelRequest <T> req)
        {
            if (_permissions == null || _permissions.Length == 0)
            {
                return(Result.Ok);
            }

            PermisionValidate covered = _permissions.FirstOrDefault(x => req.Type == x.Operation);

            if (covered == null)
            {
                return(Result.Ok);
            }

            if (!_userService.Validate(req.User, covered.Permission))
            {
                return(new Result(EnumResultBL.ERROR_PERMISSION_VALIDATIONS));
            }

            return(Result.Ok);
        }