没有足够的权限来访问nodejs中的资源

访问资源的权限不足

尝试将访问控制列表集成到我的项目中,这里将用户标识(12345)分配给访客angular色。 而我访问的url,我得到以下错误

HttpError:没有足够权限访问/ home / smi-user / chrysmo / node_modules / acl / lib / acl.js:649:14在tryCatcher(/ home / smi-user / chrysmo / node_modules / bluebird / js / main / (Promise.successAdapter [as_fulfillmentHandler0](/home/smi-user/chrysmo/node_modules/bluebird/js/main/nodeify.js:23:30)at Promise._settlePromiseAt(/ home / util.js:26:23) smith-user / chrysmo / node_modules / bluebird / js / main / promise.js:579:21)at Promise._settlePromises(/home/smi-user/chrysmo/node_modules/bluebird/js/main/promise.js:697: 14)在Async._drainQueues(/ home / smi-user / chrysmo / node_modules / bluebird / 14)处Async._drainQueue(/home/smi-user/chrysmo/node_modules/bluebird/js/main/async.js:123:16) js / main / async.js:133:10)at immediate.Async.drainQueues [as _onImmediate](/home/smi-user/chrysmo/node_modules/bluebird/js/main/async.js:15:14)at processImmediate [as _immediateCallback](timers.js:383:17)

server.js

var express = require( 'express' ); var acl = require( 'acl' ); var bodyParser = require('body-parser'); var app = express(); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); // Or Using the memory backend acl = new acl(new acl.memoryBackend()); acl.allow([ { roles:['guest','member'], allows:[ {resources:'blogs', permissions:'get'}, {resources:['forums','news'], permissions:['get','put','delete']} ] }, { roles:['gold','silver'], allows:[ {resources:'cash', permissions:['sell','exchange']}, {resources:['account','deposit'], permissions:['put','delete']} ] } ]); acl.addUserRoles('12345', 'guest'); app.get( '/blogs/:id',acl.middleware(1,getuserid()), function( request, response, next ) { console.log("test"); next(); } ); function getuserid(){ return '12345'; } // Starting the server app.listen( 3030, function() { console.log( 'ACL example listening on port 3030' ); }); 

       

网上收集的解决方案 "没有足够的权限来访问nodejs中的资源"