|
@@ -59,28 +59,30 @@ class BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
- // 校验权限
|
|
|
|
- let currentPermission = request.session.managerData.permission;
|
|
|
|
- currentPermission = currentPermission.split(',');
|
|
|
|
- let withoutPermission = ['login', 'dashboard'];
|
|
|
|
- // 工具页面整合
|
|
|
|
- let toolPermission = ['rationRepository', 'stdBillsmain'];
|
|
|
|
- let hasToolPermission = false;
|
|
|
|
- if (controller === 'tool') {
|
|
|
|
- for (let tmpPermission of toolPermission) {
|
|
|
|
- if (currentPermission.indexOf(tmpPermission) >= 0) {
|
|
|
|
- hasToolPermission = true;
|
|
|
|
- break;
|
|
|
|
|
|
+ // 如果不适超级管理员则判断权限
|
|
|
|
+ let sessionManager = request.session.managerData;
|
|
|
|
+ if (sessionManager.superAdmin !== 1) {
|
|
|
|
+ let currentPermission = sessionManager.permission;
|
|
|
|
+ // 校验权限
|
|
|
|
+ currentPermission = currentPermission.split(',');
|
|
|
|
+ let withoutPermission = ['login', 'dashboard'];
|
|
|
|
+ // 工具页面整合
|
|
|
|
+ let toolPermission = ['rationRepository', 'stdBillsmain'];
|
|
|
|
+ let hasToolPermission = false;
|
|
|
|
+ if (controller === 'tool') {
|
|
|
|
+ for (let tmpPermission of toolPermission) {
|
|
|
|
+ if (currentPermission.indexOf(tmpPermission) >= 0) {
|
|
|
|
+ hasToolPermission = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- if (!hasToolPermission && withoutPermission.indexOf(controller) < 0 &&
|
|
|
|
- (currentPermission.length <= 0 || currentPermission.indexOf(controller)) < 0) {
|
|
|
|
- console.log(currentPermission);
|
|
|
|
- console.log(controller);
|
|
|
|
|
|
+ if (!hasToolPermission && withoutPermission.indexOf(controller) < 0 &&
|
|
|
|
+ (currentPermission.length <= 0 || currentPermission.indexOf(controller)) < 0) {
|
|
|
|
|
|
- throw '没有权限';
|
|
|
|
|
|
+ throw '没有权限';
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 菜单数据
|
|
// 菜单数据
|
|
@@ -95,7 +97,7 @@ class BaseController {
|
|
response.locals.action = action;
|
|
response.locals.action = action;
|
|
|
|
|
|
// 用户session数据
|
|
// 用户session数据
|
|
- response.locals.manager = request.session.managerData;
|
|
|
|
|
|
+ response.locals.manager = sessionManager;
|
|
|
|
|
|
// moment工具
|
|
// moment工具
|
|
response.locals.moment = Moment;
|
|
response.locals.moment = Moment;
|
|
@@ -141,6 +143,7 @@ class BaseController {
|
|
|
|
|
|
next();
|
|
next();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
export default BaseController;
|
|
export default BaseController;
|