nav out-url

This commit is contained in:
devezhao 2021-12-25 13:05:33 +08:00
parent 435ab5a3c1
commit 2b3324b94f

View file

@ -67,10 +67,6 @@ public class NavBuilder extends NavManager {
new String[] { "plus", "添加项目", "BUILTIN", NAV_PROJECT + "--add" }
);
// URL 绑定实体权限
// https://www.baidu.com/$$Account
private static final String URL_BIND_EP = "\\$\\$";
/**
* 获取指定用户的导航菜单
*
@ -137,7 +133,9 @@ public class NavBuilder extends NavManager {
user, MetadataHelper.getEntity(value).getEntityCode());
} else if ("URL".equals(type)) {
String[] split = value.split(URL_BIND_EP);
// URL 绑定实体权限
// https://www.baidu.com/::ENTITY_NAME
String[] split = value.split("::");
if (split.length != 2) return false;
String bindEntity = split[1];
@ -182,7 +180,7 @@ public class NavBuilder extends NavManager {
// 管理员显示新建项目入口
if (UserHelper.isAdmin(user)) {
JSONObject add = (JSONObject) NAV_PROJECT__ADD.clone();
JSONObject add = NAV_PROJECT__ADD.clone();
replaceLang(add);
navsOfProjects.add(add);
}
@ -261,16 +259,16 @@ public class NavBuilder extends NavManager {
if (isUrlType) {
navName = "nav_url-" + navName.hashCode();
String rbtoken = RBTOKEN.get();
if (rbtoken == null) {
rbtoken = PageTokenVerify.generate(UserContextHolder.getUser());
RBTOKEN.set(rbtoken);
}
// https://getrebuild.com/docs/rbv/openapi/page-token-verify
if (navUrl.contains("$RBTOKEN$") || navUrl.contains("%24RBTOKEN%24")) {
String rbtoken = RBTOKEN.get();
if (rbtoken == null) {
rbtoken = PageTokenVerify.generate(UserContextHolder.getUser());
RBTOKEN.set(rbtoken);
}
if (navUrl.contains("$RBTOKEN$")) {
navUrl = navUrl.replace("$RBTOKEN$", rbtoken);
} else if (navUrl.contains("%24RBTOKEN%24")) {
navUrl = navUrl.replace("%24RBTOKEN%24", rbtoken);
if (navUrl.contains("$RBTOKEN$")) navUrl = navUrl.replace("$RBTOKEN$", rbtoken);
else navUrl = navUrl.replace("%24RBTOKEN%24", rbtoken);
}
if (isOutUrl) {