• 首页
  • 产品中心
    • 数式Oinone四大产品

      低代码开发平台无代码开发平台集成开发平台AI大模型开发
    • 数式Oinone体系能力

      用户与组织权限管理文件管理消息中心国际化业务审计
    • 数式Oinone核心产品特性

      低无一体面向软件公司场景无限制应用级扩容可分可合
  • 服务中心
    • 客户服务

      预约演示方案咨询私有部署找人定制
    • 开发者

      问答下载
    • Oinone学院

      社区学习

    《精讲面向软件公司的低代码平台——以Oinone为例》

  • 合作伙伴
    渠道申请伙伴名录专家库
  • 关于数式
0571-88757863

Permission Extension:How to Extend Action Permissions


I. Overview

Under the permission control strategy of this system, permission regulation for an action can only be carried out in the management center when the action interacts with a page. Currently, authorization operations cannot be performed on actions that have no interaction with pages. Therefore, this article aims to elaborate on how to integrate such actions without page interaction into the system permission management system.

II. Menu Page for Extending System Permissions

(Ⅰ) Implementation Steps

  1. Create an authorization node Implement the permission node extension interface: pro.shushi.pamirs.auth.api.extend.load.PermissionNodeLoadExtendApi#buildRootPermissions
@Component
@Order(88)
public class MyTestNodeLoadExtend implements PermissionNodeLoadExtendApi {

    public static final String MODEL = AuthTest.MODEL_MODEL;
    public static final String MODULE = TopModule.MODULE_MODULE;
    public static final String FUN = "dataStatus";

    @Override
    public List<PermissionNode> buildRootPermissions(PermissionLoadContext loadContext, List<PermissionNode> nodes) {
        // Create an authorization root node
        PermissionNode root = createMyNode();
        List<PermissionNode> newNodes = new ArrayList<>();
        // Read the Action that needs authorization from the cache
        Action cacheAction = PamirsSession.getContext().getExtendCache(ActionCacheApi.class).get(MODEL, FUN);
        if (cacheAction != null) {
            // Put this Action into the permission tree
            // The path for permission authentication is spliced according to [cacheAction.getModel() + cacheAction.getName()], which has nothing to do with MODULE. Here, MODULE can be customized.
            AuthNodeHelper.addNode(newNodes, root, AuthNodeHelper.createActionNode(MODULE, cacheAction, root));
        }
        nodes.add(0, root);
        return newNodes;
    }

    private PermissionNode createMyNode() {
        return AuthNodeHelper.createNodeWithTranslate("MyNode", "Custom Node");
    }
}
  1. In the management center, we can see the authorization nodes created in the code.
  2. Assign permissions for this action to a role, and call the dataStatus action of the AuthTest model we configured to see the effect.

III. Action Permissions under the Extended Menu

(Ⅰ) Implementation Steps:

  1. Create a viewAction for use as a permission menu "permissionExtension" is the name of the custom viewAction, used for splicing the path for authentication below. Because here we only need to use this viewAction to create authorization nodes in the system permissions. Therefore, the "permission extension form" can be named arbitrarily, and the system will use the default view.
@Model.model(AuthTest.MODEL_MODEL)
@Component
@UxRouteButton(
    action = @UxAction(name = "permissionExtension", displayName = "Permission Extension", label = "Permission Extension", contextType = ActionContextTypeEnum.CONTEXT_FREE),
    value = @UxRoute(model = AuthTest.MODEL_MODEL, viewName = "Permission Extension Form", openType = ActionTargetEnum.ROUTER))
public class AuthTestAction {

    @Action(displayName = "Enable", contextType = ActionContextTypeEnum.SINGLE)
    public AuthTest dataStatus(AuthTest data) {
        data.setOrgName("Assign a value");
        return data;
    }
}
  1. Create authorization nodes Implement the permission node extension interface: pro.shushi.pamirs.auth.api.extend.load.PermissionNodeLoadExtendApi#buildRootPermissions
@Component
@Order(88)
public class MyTestNodeLoadExtend implements PermissionNodeLoadExtendApi {

    // Create an authorization root node
    @Override
    public List<PermissionNode> buildRootPermissions(PermissionLoadContext loadContext, List<PermissionNode> nodes) {

        PermissionNode root = AuthNodeHelper.createNodeWithTranslate("CustomNode", "Custom Node");
        List<PermissionNode> newNodes = new ArrayList<>();
        newNodes.add(root);
        ViewAction viewAction = new ViewAction().setModel(AuthTest.MODEL_MODEL).setName("permissionExtension").queryOne();
        // Put this Action into the permission tree
        // The path for permission authentication is spliced according to [viewAction.getModel(), viewAction.getName()], which has nothing to do with MODULE. Here, MODULE can be customized.
        if (viewAction != null) {
            root.getNodes().add(AuthNodeHelper.createViewActionNode(TopModule.MODULE_MODULE, viewAction, root));
        }
        nodes.add(0, root);
        return newNodes;
    }

    // Create action permission nodes in the permission group
    @Override
    public List<PermissionNode> buildNextPermissions(PermissionNode selected, List<PermissionNode> nodes) {
        // Need to use the path of viewAction to determine whether the currently selected node is our created custom node. Returning null means not processing the authorization node downward. The path is spliced according to [viewAction.getModel(), viewAction.getName()]
        String path = "/" + AuthTest.MODEL_MODEL + "/" + "permissionExtension";
        if (!path.equals(selected.getPath())){
            return null;
        }
        List<PermissionNode> newNodes = new ArrayList<>();
        // Read the Actions that need authorization from the cache
        List<Action> actions = new ArrayList<>();
        actions.add(PamirsSession.getContext().getExtendCache(ActionCacheApi.class).get(AuthTest.MODEL_MODEL, "dataStatus"));
        actions.add(PamirsSession.getContext().getExtendCache(ActionCacheApi.class).get(Teacher.MODEL_MODEL, "queryTea"));
        // Put these Actions into the action permission tree for authorization
        // The path for permission authentication is spliced according to [action.getModel(), action.getName()], which has nothing to do with TopModule.MODULE_MODULE. Here, TopModule.MODULE_MODULE can be customized.
        for (Action action : actions) {
            newNodes.add(AuthNodeHelper.createActionNode(TopModule.MODULE_MODULE, action, selected));
        }
        nodes.addAll(newNodes);
        return newNodes;
    }
}
  1. In the management center, we can see the authorization nodes created in the code.
  2. Assign permissions for this action to a role, and call the dataStatus action of the AuthTest model we configured to see the effect.
Edit this page
Last Updated:1/15/26, 4:02 AM
Prev
Permission Extension:How to Delete the Default Homepage Node in System Permissions
Next
Permission Extension:How to Add Menu Permissions to Roles
默认页脚
Copyright © 2026 Mr.Hope