NutzCN Logo
精华 NutzSite1.0.3 发布 新增Redis支持 添加验证码
发布于 1900天前 作者 Hamming 3279 次浏览 复制 上一个帖子 下一个帖子
标签:

更新如下
1. 新增Redis支持
2. 添加验证码
3. 修复thymeleaf 热更新问题处理
4. 新增Globals 读取配置文件
5. 更新:动作链调整至 MyActionChainMaker 加入 SQL 注入过滤 XSS过滤
6. 修复若干BUG
https://gitee.com/TomYule/NutzSite/releases/1.0.3
https://github.com/TomYule/NutzSite/releases/tag/1.0.3
欢迎来个star

26 回复

终于有新版本发布了

thymeleaf
热更新原理是什么?

下载后打包发布到tomcat中之后只有能进入的登陆页面,点击等时登陆接口404,是什么原因

新添加的角色分配权限之后列表上的操作按钮还是显示,这是怎么回事,与权限字符有关系吗?

@qq_6c186ef5 这个是显示隐藏的问题 列表上的按钮 目前 还没想好 如何解决
shiro标签shiro:hasPermission 在列表页面 不生效

我看了若依在列表页面获取权限的是

var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');

可能是通过获取到的权限对象,之后将值写到css中,使用css控制的;我打算使用这种方式试呢,但是通过js获取shiro权限的数据的时候获取不到,

@permission 是调用的后台服务 类似JSP 调用后台方法 兽总 不建议酱紫做 然后 我就不知道如何解决好

@Service("permission")
public class PermissionService
{
    public String hasPermi(String permission)
    {
        return isPermittedOperator(permission) ? "" : "hidden";
    }

    private boolean isPermittedOperator(String permission)
    {
        return SecurityUtils.getSubject().isPermitted(permission);
    }

}

那就先用这种方式做呗,后期想到好的方式了再改呗

nutz 没有注解服务

@Service

thymeleaf 调用不了

@IocBean()

应该类似于

@Service

列表权限的问题我想了个其他办法解决了,还有就是角色权限更新之后,需要重新登陆才能生效,我看你好像没有更新到缓存或session中去,

@qq_6c186ef5 去掉缓存注解https://github.com/TomYule/NutzSite/blob/master/src/main/java/io/nutz/nutzsite/module/sys/services/UserService.java

@Cache

我早就去掉了@cache注解,还是无效,所以我改了editDo这个方法:

if(Lang.isNotEmpty(data)){
                data.setUpdateBy(ShiroUtils.getSysUserId());
                data.setUpdateTime(new Date());
                roleService.update(data);
                //新增代码
                ShiroUtils.clearCachedAuthorizationInfo();

            }
/**
     * 清理缓存
     */
    public static void clearCachedAuthorizationInfo(){
        RealmSecurityManager rsm = (RealmSecurityManager)SecurityUtils.getSecurityManager();
        SimpleAuthorizingRealm realm = (SimpleAuthorizingRealm)rsm.getRealms().iterator().next();
        realm.clearCachedAuthorizationInfo();
    }
public void clearCachedAuthorizationInfo(){
		this.clearCachedAuthorizationInfo(SecurityUtils.getSubject().getPrincipals());
	}

加了以上代码之后还是无效,我就改了application.properties中的shiro.realm.cache.enable =false,结果是分配权限时候,刷新会马上变过了,但是SimpleAuthorizingRealm中的doGet方法会重复调用,现在的问题是在那个位置更新缓存.该怎么改?

账号退出登录 重新登录 就有权限了

重新分配权限之后推出重新登陆,这样太麻烦了,怎么样做让分配完马上生效,现在就需要更新缓存的问题

那就不缓存
shiro.realm.cache.enable =false

bootstrap-table-export下载报错,是没开发完吗

[WARN ] 17:26:40.331 io.nutz.nutzsite.common.mvc.processor.ErrorProcessor.process(ErrorProcessor.java:41) - Error@/sys/dict/list :
org.nutz.castor.FailToCastObjectException: Fail to cast 'NaN' to <int>
	at org.nutz.castor.castor.String2Number.cast(String2Number.java:60)
	at org.nutz.castor.castor.String2Number.cast(String2Number.java:19)
	at org.nutz.castor.Castors.cast(Castors.java:253)
	at org.nutz.castor.Castors.castTo(Castors.java:317)
	at org.nutz.castor.castor.Array2Object.cast(Array2Object.java:21)
	at org.nutz.castor.Castors.cast(Castors.java:253)
	at org.nutz.castor.Castors.castTo(Castors.java:317)
	at org.nutz.mvc.adaptor.injector.NameInjector.fromReqParam(NameInjector.java:117)
	at org.nutz.mvc.adaptor.injector.NameInjector.get(NameInjector.java:102)
	at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:294)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:30)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at io.nutz.nutzsite.common.mvc.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:80)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at io.nutz.nutzsite.common.mvc.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:43)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:56)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:171)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1592)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1296)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1211)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:500)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:386)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:562)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:378)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NumberFormatException: For input string: "NaN"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.valueOf(Integer.java:766)
	at org.nutz.castor.castor.String2Integer.valueOf(String2Integer.java:29)
	at org.nutz.castor.castor.String2Integer.valueOf(String2Integer.java:5)
	at org.nutz.castor.castor.String2Number.cast(String2Number.java:54)
	... 72 more

bootstrap-table-export没有做你看一下文档 https://github.com/hhurz/tableExport.jquery.plugin
后台这边 pageNum是int 传过来NaN自然就报错了

@tonyyule 好的,我研究下。可以考虑加入多数据源功能

东西不错,拿来当脚手架了。功能不要特别复杂够用就行,以前用过ruoyi、guns东西越来越重。简单最好,nutzboot不错想用什么用什么。

@chinagz 感谢支持 欢迎来个star

上下文根这么操作
SpringBoot:server.servlet.context-path=/demo
nutzboot咋弄

找到了:jetty.contextPath

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