NutzCN Logo
问答 nutzwk中NutShiroProcessor中对于验证权限应该用什么注解
发布于 2491天前 作者 zp8821138 1609 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

貌似@RequiresPermissions("sys:user:save")并没有效

我看代码有NutzRequiresPermissions注解 是要用这个注解才行吗?

public @interface NutzRequiresPermissions {

	String[] value();

	Logical logical() default Logical.AND;

	/** 是否加入到数据库 */
	boolean enable() default false;

	/** 一级分类中的二级分类 */
	String name();

	/** 一级分类 */
	String tag();

}

这个name tag都是啥意思。

11 回复

那是自动扫描注解入库的时候用的,跟判断权限的逻辑没什么关系

@RequiresPermissions("sys:user:save") 无法生效 貌似 并没有跳转到没有权限的提醒页面。 貌似exception类型不对 debug后是空指针异常。

protected void whenException(ActionContext ac, Exception e)
			throws Throwable {
		Object val = ac.getRequest().getAttribute("shiro_auth_error");
		if (val != null && val instanceof View) {
			((View) val).render(ac.getRequest(), ac.getResponse(), null);
			return;
		}
		if (e instanceof UnauthenticatedException) {
			whenUnauthenticated(ac, (UnauthenticatedException) e);
		} else if (e instanceof UnauthorizedException) {
			whenUnauthorized(ac, (UnauthorizedException) e);
		} else {
			whenOtherException(ac, e);
		}
	}

贴日志看看

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:20,809 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/user/add : UserController.add(UserController.java:110)
[DEBUG] 2018-02-26 16:11:20,810 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'userController'<class com.kanq.controller.sys.UserController>
[DEBUG] 2018-02-26 16:11:20,813 org.nutz.plugins.cache.impl.redis.RedisCache2.get(RedisCache2.java:29) - GET key=shiroDbRealm.authorizationCache:User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]
[DEBUG] 2018-02-26 16:11:20,815 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/sys/user/add 5ms
[DEBUG] 2018-02-26 16:11:20,821 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/login : LoginController.login(LoginController.java:46)
[DEBUG] 2018-02-26 16:11:20,821 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'loginController'<class com.kanq.controller.sys.LoginController>
[DEBUG] 2018-02-26 16:11:20,823 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/login 1ms
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:20,829 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/home : HomeController.home(HomeController.java:33)
[DEBUG] 2018-02-26 16:11:20,829 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'homeController'<class com.kanq.controller.sys.HomeController>
[DEBUG] 2018-02-26 16:11:20,830 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/home 1ms
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:21,180 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/menu/user : MenuController.user(MenuController.java:44)
[DEBUG] 2018-02-26 16:11:21,185 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'menuController'<class com.kanq.controller.sys.MenuController>
[DEBUG] 2018-02-26 16:11:21,186 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT DISTINCT rm.menuId menuId FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId WHERE ur.userId = ?, tables = [sys_user_role, sys_role_menu]
[DEBUG] 2018-02-26 16:11:21,186 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT DISTINCT rm.menuId menuId FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId WHERE ur.userId = ?
[DEBUG] 2018-02-26 16:11:21,187 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT DISTINCT rm.menuId menuId FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId WHERE ur.userId = ?
    |                                1 |
    |----------------------------------|
    | 177256f2f502404da51bcacc4c49a4ff |
  For example:> "SELECT DISTINCT rm.menuId menuId FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId WHERE ur.userId = '177256f2f502404da51bcacc4c49a4ff'"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:21,189 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/role/select : RoleController.select(RoleController.java:56)
[DEBUG] 2018-02-26 16:11:21,190 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'roleController'<class com.kanq.controller.sys.RoleController>
[DEBUG] 2018-02-26 16:11:21,190 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT id,name FROM sys_role ORDER BY id ASC, tables = [sys_role]
[DEBUG] 2018-02-26 16:11:21,191 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159) - KEY=-1369306951:_:_:SELECT id,name FROM sys_role ORDER BY id ASC SQL=SELECT id,name FROM sys_role ORDER BY id ASC
[DEBUG] 2018-02-26 16:11:21,193 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:165) - cache found key=-1369306951:_:_:SELECT id,name FROM sys_role ORDER BY id ASC
[DEBUG] 2018-02-26 16:11:21,194 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/sys/role/select 4ms
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:21,198 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/user/perms : UserController.listUserPerms(UserController.java:84)
[DEBUG] 2018-02-26 16:11:21,199 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'userController'<class com.kanq.controller.sys.UserController>
[DEBUG] 2018-02-26 16:11:21,200 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT DISTINCT * FROM (SELECT m.permission permission FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId LEFT JOIN sys_menu m ON rm.menuId = m.id WHERE ur.userId=? and m.permission is not null ORDER BY m.location ASC), tables = [sys_user_role, sys_role_menu, sys_menu]
[DEBUG] 2018-02-26 16:11:21,200 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT DISTINCT * FROM (SELECT m.permission permission FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId LEFT JOIN sys_menu m ON rm.menuId = m.id WHERE ur.userId=? and m.permission is not null ORDER BY m.location ASC)
[DEBUG] 2018-02-26 16:11:21,201 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT DISTINCT * FROM (SELECT m.permission permission FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId LEFT JOIN sys_menu m ON rm.menuId = m.id WHERE ur.userId=? and m.permission is not null ORDER BY m.location ASC)
    |                                1 |
    |----------------------------------|
    | 177256f2f502404da51bcacc4c49a4ff |
  For example:> "SELECT DISTINCT * FROM (SELECT m.permission permission FROM sys_user_role ur LEFT JOIN sys_role_menu rm ON ur.roleId = rm.roleId LEFT JOIN sys_menu m ON rm.menuId = m.id WHERE ur.userId='177256f2f502404da51bcacc4c49a4ff' and m.permission is not null ORDER BY m.location ASC)"
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:21,204 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/user/info : UserController.info(UserController.java:70)
[DEBUG] 2018-02-26 16:11:21,205 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'userController'<class com.kanq.controller.sys.UserController>
[DEBUG] 2018-02-26 16:11:21,206 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT * FROM sys_user  WHERE id=?, tables = [sys_user]
[DEBUG] 2018-02-26 16:11:21,207 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159) - KEY=-1892077532:_:_:SELECT * FROM sys_user  WHERE id=?:177256f2f502404da51bcacc4c49a4ff SQL=SELECT * FROM sys_user  WHERE id=?
[DEBUG] 2018-02-26 16:11:21,207 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:165) - cache found key=-1892077532:_:_:SELECT * FROM sys_user  WHERE id=?:177256f2f502404da51bcacc4c49a4ff
[DEBUG] 2018-02-26 16:11:21,208 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT * FROM sys_role  WHERE id IN (SELECT roleId FROM sys_user_role WHERE userId='177256f2f502404da51bcacc4c49a4ff'), tables = [sys_role, sys_user_role]
[DEBUG] 2018-02-26 16:11:21,209 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT * FROM sys_role  WHERE id IN (SELECT roleId FROM sys_user_role WHERE userId='177256f2f502404da51bcacc4c49a4ff')
[DEBUG] 2018-02-26 16:11:21,210 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_role  WHERE id IN (SELECT roleId FROM sys_user_role WHERE userId='177256f2f502404da51bcacc4c49a4ff')
[DEBUG] 2018-02-26 16:11:21,515 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/sys/user/info 310ms
[DEBUG] 2018-02-26 16:11:21,520 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/sys/user/perms 321ms
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:21,554 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/sys/upload/download : UploadController.download(UploadController.java:115)
[DEBUG] 2018-02-26 16:11:21,554 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'uploadController'<class com.kanq.controller.sys.UploadController>
[DEBUG] 2018-02-26 16:11:21,555 org.nutz.mvc.view.RawView.render(RawView.java:116) - File downloading ... d:\pic6c80e378-f806-4f94-bce5-31b690e86872.png
[DEBUG] 2018-02-26 16:11:21,555 org.nutz.mvc.view.RawView.render(RawView.java:118) - File downloading ... Not Exist : d:\pic6c80e378-f806-4f94-bce5-31b690e86872.png
[DEBUG] 2018-02-26 16:11:21,555 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/sys/upload/download 1ms
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:22,353 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/home/main : HomeController.main(HomeController.java:38)
[DEBUG] 2018-02-26 16:11:22,384 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'homeController'<class com.kanq.controller.sys.HomeController>
[DEBUG] 2018-02-26 16:11:22,385 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT COUNT(*) FROM sys_user , tables = [sys_user]
[DEBUG] 2018-02-26 16:11:22,385 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159) - KEY=483313329:_:_:SELECT COUNT(*) FROM sys_user  SQL=SELECT COUNT(*) FROM sys_user 
[DEBUG] 2018-02-26 16:11:22,385 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:165) - cache found key=483313329:_:_:SELECT COUNT(*) FROM sys_user 
[DEBUG] 2018-02-26 16:11:22,386 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT COUNT(*) FROM cms_category , tables = [cms_category]
[DEBUG] 2018-02-26 16:11:22,386 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159) - KEY=-33811110:_:_:SELECT COUNT(*) FROM cms_category  SQL=SELECT COUNT(*) FROM cms_category 
[DEBUG] 2018-02-26 16:11:22,387 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:165) - cache found key=-33811110:_:_:SELECT COUNT(*) FROM cms_category 
[DEBUG] 2018-02-26 16:11:22,387 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT COUNT(*) FROM cms_content , tables = [cms_content]
[DEBUG] 2018-02-26 16:11:22,388 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT COUNT(*) FROM cms_content 
[DEBUG] 2018-02-26 16:11:22,388 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM cms_content 
[DEBUG] 2018-02-26 16:11:22,391 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/home/main 7ms
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
User [id=177256f2f502404da51bcacc4c49a4ff, loginname=a, password=PEtImRme9wvSAY+Cwn1hxFYztWjIzfDxZts7Aj+4bDI=, salt=iW7My0Jv8QpxFctAxZXy0w==, nickname=b, isOnline=false, disabled=false, email=ddd@dd.com, loginAt=1519628306, loginIp=null, loginCount=7, roles=null]$$$$$$$$$$$$$$$
[DEBUG] 2018-02-26 16:11:22,520 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/cms/statistics/findAllMonthCount : StatisticsController.findAllMonthCount(StatisticsController.java:22)
[DEBUG] 2018-02-26 16:11:22,520 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) - Get 'statisticsController'<class com.kanq.controller.cms.StatisticsController>
[DEBUG] 2018-02-26 16:11:22,530 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT SUM (CASE WHEN mon = '01' THEN 1 ELSE 0 END) AS a, SUM (CASE WHEN mon = '02' THEN 1 ELSE 0 END) AS b, SUM (CASE WHEN mon = '03' THEN 1 ELSE 0 END) AS c, SUM (CASE WHEN mon = '04' THEN 1 ELSE 0 END) AS d, SUM (CASE WHEN mon = '05' THEN 1 ELSE 0 END) AS e, SUM (CASE WHEN mon = '06' THEN 1 ELSE 0 END) AS f, SUM (CASE WHEN mon = '07' THEN 1 ELSE 0 END) AS g, SUM (CASE WHEN mon = '08' THEN 1 ELSE 0 END) AS h, SUM (CASE WHEN mon = '09' THEN 1 ELSE 0 END) AS i, SUM (CASE WHEN mon = '10' THEN 1 ELSE 0 END) AS j, SUM (CASE WHEN mon = '11' THEN 1 ELSE 0 END) AS k, SUM (CASE WHEN mon = '12' THEN 1 ELSE 0 END) AS l FROM (SELECT to_char((to_date('1970-01-01','YYYY-MM-DD')+publishAt/24/60/60),'YYYY') AS year,to_char((to_date('1970-01-01','YYYY-MM-DD')+publishAt/24/60/60),'MM') AS mon from cms_content) where year=(SELECT to_char(sysdate,'yyyy') FROM DUAL);, tables = [cms_content, DUAL]
[DEBUG] 2018-02-26 16:11:22,531 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:178) - not good for cache >> SELECT SUM (CASE WHEN mon = '01' THEN 1 ELSE 0 END) AS a, SUM (CASE WHEN mon = '02' THEN 1 ELSE 0 END) AS b, SUM (CASE WHEN mon = '03' THEN 1 ELSE 0 END) AS c, SUM (CASE WHEN mon = '04' THEN 1 ELSE 0 END) AS d, SUM (CASE WHEN mon = '05' THEN 1 ELSE 0 END) AS e, SUM (CASE WHEN mon = '06' THEN 1 ELSE 0 END) AS f, SUM (CASE WHEN mon = '07' THEN 1 ELSE 0 END) AS g, SUM (CASE WHEN mon = '08' THEN 1 ELSE 0 END) AS h, SUM (CASE WHEN mon = '09' THEN 1 ELSE 0 END) AS i, SUM (CASE WHEN mon = '10' THEN 1 ELSE 0 END) AS j, SUM (CASE WHEN mon = '11' THEN 1 ELSE 0 END) AS k, SUM (CASE WHEN mon = '12' THEN 1 ELSE 0 END) AS l FROM (SELECT to_char((to_date('1970-01-01','YYYY-MM-DD')+publishAt/24/60/60),'YYYY') AS year,to_char((to_date('1970-01-01','YYYY-MM-DD')+publishAt/24/60/60),'MM') AS mon from cms_content) where year=(SELECT to_char(sysdate,'yyyy') FROM DUAL);
[DEBUG] 2018-02-26 16:11:22,531 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT SUM (CASE WHEN mon = '01' THEN 1 ELSE 0 END) AS a, SUM (CASE WHEN mon = '02' THEN 1 ELSE 0 END) AS b, SUM (CASE WHEN mon = '03' THEN 1 ELSE 0 END) AS c, SUM (CASE WHEN mon = '04' THEN 1 ELSE 0 END) AS d, SUM (CASE WHEN mon = '05' THEN 1 ELSE 0 END) AS e, SUM (CASE WHEN mon = '06' THEN 1 ELSE 0 END) AS f, SUM (CASE WHEN mon = '07' THEN 1 ELSE 0 END) AS g, SUM (CASE WHEN mon = '08' THEN 1 ELSE 0 END) AS h, SUM (CASE WHEN mon = '09' THEN 1 ELSE 0 END) AS i, SUM (CASE WHEN mon = '10' THEN 1 ELSE 0 END) AS j, SUM (CASE WHEN mon = '11' THEN 1 ELSE 0 END) AS k, SUM (CASE WHEN mon = '12' THEN 1 ELSE 0 END) AS l FROM (SELECT to_char((to_date('1970-01-01','YYYY-MM-DD')+publishAt/24/60/60),'YYYY') AS year,to_char((to_date('1970-01-01','YYYY-MM-DD')+publishAt/24/60/60),'MM') AS mon from cms_content) where year=(SELECT to_char(sysdate,'yyyy') FROM DUAL);
[DEBUG] 2018-02-26 16:11:22,538 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw//platform/cms/statistics/findAllMonthCount 18ms
[DEBUG] 2018-02-26 16:11:23,305 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  , tables = [sys_menu]
[DEBUG] 2018-02-26 16:11:23,306 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159) - KEY=1032807786:_:_:SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  : SQL=SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  
[DEBUG] 2018-02-26 16:11:23,307 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:165) - cache found key=1032807786:_:_:SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  :
[DEBUG] 2018-02-26 16:11:23,308 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:148) - sql = SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  , tables = [sys_menu]
[DEBUG] 2018-02-26 16:11:23,309 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:159) - KEY=1250200476:_:_:SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  :5da71fb7fe364a1ea859c21bf2b7b6b2 SQL=SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  
[DEBUG] 2018-02-26 16:11:23,310 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:165) - cache found key=1250200476:_:_:SELECT * FROM sys_menu  WHERE parentId=? ORDER BY location ASC  :5da71fb7fe364a1ea859c21bf2b7b6b2
[DEBUG] 2018-02-26 16:11:23,315 com.kanq.processor.LogTimeProcessor.process(LogTimeProcessor.java:22) - [GET ]URI=/sjw/platform/sys/menu/user 2130ms

这个是已经登录,没有用户添加权限的,我直接在地址栏输入sys/user/add跳转登陆界面,debug到whenException中是空指针异常,走的whenOtherException。没办法关联shiro源码 蛋疼。。

上述日志是页面地址栏输入没有权限url的日志 感觉没啥用。

找找哪里NPE吧

我记得nutzwk其他地方都是 . 不是 : 吧~~虽然:也能用

改了很多代码。。不知道哪里改错了 debug了一下 subject.checkPermission(perms[0]);这个地方有问题,是不是登陆后subject没有设置所拥有的permissions所以没有抛出AuthorizationException这个异常?

 protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        User user = (User) principals.getPrimaryPrincipal();
        if (!Lang.isEmpty(user)) {
            SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
            //info.addRoles(getUserService().getRoleCodeList(user));
            for (Role role : user.getRoles()) {
                if (!role.isDisabled())
                    info.addStringPermissions(getRoleService().getPermissionNameList(role));
            }
            return info;
        } else {
            return null;
        }
    }

这个的问题?

doGetAuthorizationInf这个没有进去。。。。

添加回复
请先登陆
回到顶部