✨ 列表导出补齐创建人创建时间,并修复组织类型提交
多模块列表与导出展示创建人、创建时间;组织类型强制提交数字编码,避免中文 dictKey 反序列化失败。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+24
-1
@@ -6,8 +6,31 @@ const RefreshTokenKey = website.refreshTokenKey;
|
||||
const SessionId = 'JSESSIONID';
|
||||
const UserId = 'b-user-id';
|
||||
|
||||
/** 超级管理员角色别名 */
|
||||
export const ADMINISTRATOR_ROLE_ALIAS = 'administrator';
|
||||
|
||||
/**
|
||||
* 是否超级管理员:角色别名中包含 administrator 即为超级管理员
|
||||
*
|
||||
* @param {object|string|string[]} [userInfoOrAuthority] 用户信息,或 authority / role_name 字符串/数组
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isAdministrator(userInfoOrAuthority) {
|
||||
let authority = userInfoOrAuthority;
|
||||
if (authority && typeof authority === 'object' && !Array.isArray(authority)) {
|
||||
authority = authority.authority ?? authority.role_name ?? authority.roleName ?? '';
|
||||
}
|
||||
const roles = Array.isArray(authority)
|
||||
? authority
|
||||
: String(authority || '')
|
||||
.split(/[,,]/)
|
||||
.map(role => role.trim())
|
||||
.filter(Boolean);
|
||||
return roles.some(role => String(role).trim() === ADMINISTRATOR_ROLE_ALIAS);
|
||||
}
|
||||
|
||||
export function getToken() {
|
||||
return Cookies.get(TokenKey);
|
||||
return Cookies.get(TokenKey);
|
||||
}
|
||||
|
||||
export function setToken(token) {
|
||||
|
||||
Reference in New Issue
Block a user