wuwanyu / node_acldemo Goto Github PK
View Code? Open in Web Editor NEWexpress搭建权限管理系统(基于node_acl)
express搭建权限管理系统(基于node_acl)
hello,博主,首先感谢你写了这个demo,让我学了不少。
在运行demo的时候,遇到上面的问题,看官方文档是用acl.middleware()来保护资源。
你好,请问登陆成功后,在其他页面(不包含公共头和尾的页面),如何获取登陆状态
node_aclDemo/config/public.js这个public文件作用是什么?
我准备把你这个拆成前后端分离的项目(在用express脚手架构建的基础上),在修改了app和config以及bin/www文件后,报了个这个错你能够解决一下?
方便留个联系方式?我打算用这个做管理系统的基础,想和你深度交流下。
waterline initialize failed, err: { userError: Could not find a primary key attribute on the model acl_user
. All models must contain an attribute that acts as the primary key and is guaranteed to be unique.
at normalizeCollection (E:\obj\monitor\node_modules\waterline-schema\lib\waterline-schema\schema.js:85:44)
at arrayEach (E:\obj\monitor\node_modules@sailshq\lodash\lib\index.js:1463:13)
at Function. (E:\obj\monitor\node_modules@sailshq\lodash\lib\index.js:3525:13)
at schemaBuilder (E:\obj\monitor\node_modules\waterline-schema\lib\waterline-schema\schema.js:34:5)
at new WaterlineSchema (E:\obj\monitor\node_modules\waterline-schema\lib\waterline-schema.js:36:12)
at Object.initialize (E:\obj\monitor\node_modules\waterline\lib\waterline.js:581:26)
at Object. (E:\obj\monitor\bin\www:14:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3 name: 'userError' }
node_aclDemo/app/controllers/acl_role.js
Line 35 in 92a8ec3
你好,我在controller下的js文件中添加一个包含$inc的更新数据的方法,但是不能执行,好像是mongoose有限制
在目录文件node_aclDemo\app\controllers\acl_user.js里面getOne()模块下调用的waterline.models.acl_user这个方法是写在哪里的?,看了一下没找到这个方法写在哪里,还望不吝赐教。
补充:
在目录文件下node_aclDemo\app\controllers\acl_user.js里面引入的
var waterline = require('../../config/waterline');
waterline文件里面导出的models是null。
所以我感觉acl_user.js下面的getOne()模块查不到数据,但是想了解下你这里是怎么查询数据库的。
Now the Casbin project ports their Golang library to Node.js named Node-Casbin. It supports ACL, RBAC, ABAC. You can refer to: https://github.com/casbin/node-casbin
在app/router/acl_role.js里面,有info和whatResources两个方法各起的什么作用?他们互不影响?还是有继承关系?我只看懂了第二个方法是acl的根绝角色id查询角色有哪些权限的。有很多地方都是这种写法,或者说这种关系,求教哇。
//根据id查询一条
router.post('/getOne', function(req, res) {
var param = req.body;
try {
async.auto({
info: function(cb) {
let list = roleController.getOne(param, cb);
console.log('13' + list)
},
whatResources: function(cb) {
global.acl.whatResources(param.id, cb)
},
}, function(err, data) {
res.send({
code: "200",
msg: "获取详情成功",
result: {
info: data.info,
resources: data.whatResources
}
});
});
} catch (err) {
res.end(err.stack);
}
});
看到你使用到了node-acl,在waterline.js文件里面是怎么使用acl的?或者项目里面哪些地方使用到了acl?
没看到你代码里是怎么对角色、权限、资源的操作【admin/user/user2的权限控制不是太清楚】
您好,由于电脑上没安装mongodb,所以没有把您的程序运行起来,但是我有注意到您在 resource.hbs 这个view中直接使用 zTree的css文件
我想问下 这样直接引入会被渲染到页面的head 中 还是 渲染到 {{{body}}} 中 ,还是您在某个地方配置有helper 。 我测试了下我的会被直接渲染到{{{body}}} 中 。
期待您的回答
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.