AngualrJs 最新 文件图片上传教程9:Server-policies
2017-09-15 09:57
555 查看
womeninformationmanagement.server.policy.js
'use strict'; /** * Module dependencies */ var acl = require('acl'); // Using the memory backend acl = new acl(new acl.memoryBackend()); /** * Invoke WomenInformationManagement Permissions */ exports.invokeRolesPolicies = function () { acl.allow([{ roles: ['user', 'admin'], allows: [{ resources: '/api/womenInformationManagement', permissions: '*' }, { resources: '/api/womenInformationManagement/:womenInformationManagementId', permissions: '*' }] }]); }; /** * Check If WomenInformationManagement Policy Allows */ exports.isAllowed = function (req, res, next) { var roles = (req.user) ? req.user.roles : ['guest']; // Check for user roles acl.areAnyRolesAllowed(roles, req.route.path, req.method.toLowerCase(), function (err, isAllowed) { if (err) { // An authorization error occurred return res.status(500).send('Unexpected authorization error'); } else { if (isAllowed) { // Access granted! Invoke next middleware return next(); } else { return res.status(403).json({ message: 'User is not authorized' }); } } }); };
相关文章推荐
- AngualrJs 最新 文件图片上传教程6:Server-config
- AngualrJs 最新 文件图片上传教程7:Server-controllers
- AngualrJs 最新 文件图片上传教程10:Server-routes
- AngualrJs 最新 文件图片上传教程8:Server-models
- AngualrJs 最新 文件图片上传教程4:Client-Services
- AngualrJs 最新 文件图片上传教程5:Client-css Client-config
- AngualrJs 最新 文件图片上传教程1:Client-View
- AngualrJs 最新 文件图片上传教程0:Client-module
- AngualrJs 最新 文件图片上传教程2:Client-Controller-modal
- AngualrJs 最新 文件图片上传教程3:Client-Controller-curdtable
- webuploader服务器端接收文件的脚本分析,server端怎么接收上传的文件和图片-百度webuploader教程5
- [置顶] FineUploader文件/图片和form表单参数一起上传,从入门到精通教程
- 上传图片/文件到server
- UEditor配置:图片上传和文件上传独立使用方法,兼容最新版 UEditor 1.4.3
- UEditor配置:图片上传和文件上传独立使用方法,兼容最新版 UEditor 1.4.3
- 如何使用PHP上传文件,上传图片,php上传教程,php表单文件上传教程
- SpringMVC上传图片文件到 阿里云【2018年最新版】【JavaWeb】
- SiteServer CMS 上传文件过滤,只能是图片格式。
- ServerU FTP 9.1.0.5完美破解版 使用教程 学校局域网上课上传下载文件用--图片来自网络
- YII中Ueditor富文本编辑器文件和图片上传的配置图文教程