Wicket Authorization Using MetaDataKey

安稳与你 提交于 2019-12-08 15:42:33

Your RoleCheck class should implement Serializable.

And are you using Wicket 1.4 ? In which case I'd suggest proceeding this way :

public class RolePermissionKey extends MetaDataKey<RoleCheck> {
    public static final RolePermissionKey KEY = new RolePermissionKey();
}

To add it to a componenet :

editLink.setMetaData(RolePermissionKey.KEY, new RoleCheck("Update"));

And to perform the authorization :

RoleCheck privCheck = component.getMetaData(RolePermissionKey.KEY)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!