root 添加权限 手机号可以使用

This commit is contained in:
Wang Kejun 2023-03-15 10:12:48 +08:00
parent 2f2a3b9add
commit 496a59aca3
2 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@ exports.default = OakComponent({
},
lifetimes: {
ready: function () {
var isRoot = this.features.token.isRoot();
var application = this.features.application.getApplication();
var _a = application, type = _a.type, config = _a.config; // 这个页面总不可能是第一个页面吧application肯定初始化完成了
var grantByUserEntityGrant = false, grantByMobile = false, grantByEmail = false;
@ -29,7 +30,7 @@ exports.default = OakComponent({
(0, assert_1.default)(type === 'web');
var passport = config.passport || [];
grantByEmail = passport.includes('email');
grantByMobile = passport.includes('mobile');
grantByMobile = isRoot || passport.includes('mobile');
grantByUserEntityGrant = passport.includes('wechat');
}
var grantMethodCount = 0;

View File

@ -18,6 +18,7 @@ export default OakComponent({
},
lifetimes: {
ready() {
const isRoot = this.features.token.isRoot();
const application = this.features.application.getApplication();
const { type, config } = application!; // 这个页面总不可能是第一个页面吧application肯定初始化完成了
let grantByUserEntityGrant = false,
@ -29,7 +30,8 @@ export default OakComponent({
assert(type === 'web');
const passport = (config as WebConfig).passport || [];
grantByEmail = passport.includes('email');
grantByMobile = passport.includes('mobile');
// 是超级管理员 不需要根据配置手机号来判断 by wkj
grantByMobile = isRoot || passport.includes('mobile');
grantByUserEntityGrant = passport.includes('wechat');
}
let grantMethodCount = 0;