Skip to content

Commit

Permalink
xui:permissions转换为xui:roles之后与已有的xui:roles合并,并且转换为字符串
Browse files Browse the repository at this point in the history
  • Loading branch information
entropy-cloud committed Jan 22, 2025
1 parent 272fa27 commit 4a16c09
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nop-web/src/main/java/io/nop/web/page/PageProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.nop.commons.concurrent.executor.ExecutorHelper;
import io.nop.commons.concurrent.executor.GlobalExecutors;
import io.nop.commons.lang.impl.Cancellable;
import io.nop.commons.util.CollectionHelper;
import io.nop.commons.util.StringHelper;
import io.nop.core.CoreConstants;
import io.nop.core.i18n.I18nMessageManager;
Expand Down Expand Up @@ -186,15 +187,17 @@ public Map<String, Object> getPage(String path, String locale) {
return data;
}

Object transformPermissions(Object value) {
protected Object transformPermissions(Object value) {
Map<String, Object> map = (Map<String, Object>) value;
Object perms = map.remove(WebConstants.ATTR_XUI_PERMISSIONS);
if (perms == null)
return value;

Set<String> permissions = ConvertHelper.toCsvSet(perms);
Set<String> roles = rolePermissionMapping.getRolesWithPermission(permissions);
map.put(WebConstants.ATTR_XUI_ROLES, roles);
Set<String> oldRoles = ConvertHelper.toCsvSet(map.get(WebConstants.ATTR_XUI_ROLES));
Set<String> merged = CollectionHelper.mergeSet(roles, oldRoles);
map.put(WebConstants.ATTR_XUI_ROLES, merged);
return map;
}

Expand Down

0 comments on commit 4a16c09

Please sign in to comment.