public class LinkPriv extends AbstractMenuPriv { public static final String MenuID = "LinkManage"; public LinkPriv() { super(MenuID, null); } } |
2)申明多个静态常量,分别存储各操作类型对应的权限项的ID(需将菜单ID作为权限项ID的前缀)。在构造方法中通过addItem(String itemID, String itemName)方法添加权限项。
public class LinkPriv extends AbstractMenuPriv { public static final String MenuID = "LinkManage"; public static final String Add = MenuID + ".Add"; public static final String Edit = MenuID + ".Edit"; public static final String Delete = MenuID + ".Delete"; public LinkPriv() { super(MenuID, null); addItem(Add, "@{Common.Add}"); addItem(Edit, "@{Common.Edit}"); addItem(Delete, "@{Common.Delete}"); } } |
向菜单权限扩展服务MenuPrivService注册权限项
注册后的菜单权限项会显示在系统管理的菜单权限管理界面
若菜单下没有注册相关的权限项,需要显示上图统计分析下类似的备注信息时,可以在调用父类的构造方法初始化时,通过第二个参数进行设置。
代码示例:
public class AnalysisPriv extends AbstractMenuPriv { public static final String MenuID = "MainMenus.Analysis"; public AnalysisPriv() { super(MenuID, "@{Platform.Menu.NoPriv}"); } } |
所有评论仅代表网友意见