diff --git a/README.md b/README.md index a1f13175632dda37cc3271eeb457db4c5d2bc34e..20c84b23c8cdb7126811f951ae81a958a3330a7a 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,8 @@ ps: 虽然我知道,大部分人都是来了**直接下载源代码**后就潇 1. 数据库链接属性(可搜索`datasource`或定位到L.19) 2. redis配置(可搜索`redis`或定位到L.69) 3. mail配置(可搜索`mail`或定位到L.89) - 4. 【[七牛云](http://qiniu.com)】配置(可搜索`qiniu`或定位到L.135) + 4. 【[七牛云](http://qiniu.com)】配置(见sys_config表中qiniu_*开头的字段) + 注:因为系统存在redis缓存,如果是第一次使用,可以直接修改sys_config表内容,如果不是第一次用,建议使用admin项目中的`系统配置`页面修改相关配置内容 5. 运行项目(三种方式) 1. 项目根目录下执行`mvn -X clean package -Dmaven.test.skip=true`编译打包,然后执行`java -jar target/blog-web.jar` 2. 项目根目录下执行`mvn springboot:run` @@ -81,10 +82,21 @@ _超级管理员_: 账号:root 密码:123456 (本地测试使用这个 _普通管理员_: 账号:admin 密码:123456 +_评论审核管理员_: 账号:comment-admin 密码:123456 + +注:后台用户的创建,尽可能做到**权限最小化** + 更多详情,请参考【[Wiki](https://gitee.com/yadong.zhang/DBlog/wikis)】 ### 更新日志 +2018-05-22 + +**修改功能:** + +1. 完善shiro权限(数据库、页面)。注:需要重新执行下`sys_resources`和`sys_role_resources`两张表的`insert`语句 +2. redis配置默认不含密码(鉴于大多数朋友的redis都没有密码做此修改,不过本人 **强烈建议**设置下密码) + 2018-05-18 **修复bug:** diff --git a/blog-admin/src/main/java/com/zyd/blog/controller/RenderController.java b/blog-admin/src/main/java/com/zyd/blog/controller/RenderController.java index 8d19b55c687dc3a636ec2c49a6a59c28e1a117c9..70f89043d1512886f3db1a3c09f1f5aa13b55bfd 100644 --- a/blog-admin/src/main/java/com/zyd/blog/controller/RenderController.java +++ b/blog-admin/src/main/java/com/zyd/blog/controller/RenderController.java @@ -34,15 +34,8 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * 页面跳转类 * @@ -164,42 +157,11 @@ public class RenderController { return ResultUtil.view("sysWebpage/list"); } - @GetMapping("/list") - public ModelAndView list(Model model) { - return ResultUtil.view("list"); - } - - @GetMapping("/details") - public ModelAndView detail(Model model) { - return ResultUtil.view("detail"); - } - - @GetMapping("/ztree") - public ModelAndView ztree(Model model) { - return ResultUtil.view("ztree"); - } - @GetMapping("/icons") public ModelAndView icons(Model model) { return ResultUtil.view("icons"); } - @PostMapping("/getZtree") - @ResponseBody - public List> getTree() { - List> mapList = new ArrayList>(); - Map map = null; - for (int i = 0; i < 20; i++) { - map = new HashMap<>(4); - map.put("id", i); - map.put("pId", (i % 3 > 0 ? i - 1 : 0)); - map.put("checked", (i % 3 > 0 ? i - 1 : 0) != 0); - map.put("name", "菜单i"); - mapList.add(map); - } - return mapList; - } - @GetMapping("/shiro") public ModelAndView shiro(Model model) { return ResultUtil.view("shiro"); diff --git a/blog-admin/src/main/resources/application.yml b/blog-admin/src/main/resources/application.yml index b4644c7fd5b63318e5f81ef62281f24e53fe8b28..eab77adcae376c09b24bd8b692c22c3acee784e8 100644 --- a/blog-admin/src/main/resources/application.yml +++ b/blog-admin/src/main/resources/application.yml @@ -73,7 +73,7 @@ spring: # Redis服务器连接端口 port: 6379 # Redis服务器连接密码(默认为空) - password: qwe!@#123 + password: # 连接池最大连接数(使用负值表示没有限制) pool: maxActive: 8 diff --git a/blog-admin/src/main/resources/templates/article/list.ftl b/blog-admin/src/main/resources/templates/article/list.ftl index f3af8b828e2694ba07eb244a557b54927187b802..f7dda423607ec097bf64b96f48cc685a0b1cc102 100644 --- a/blog-admin/src/main/resources/templates/article/list.ftl +++ b/blog-admin/src/main/resources/templates/article/list.ftl @@ -11,13 +11,19 @@
@@ -39,11 +45,11 @@ function operateFormatter(code, row, index) { var trId = row.id; var operateBtn = [ - '推送', - '置顶', - '推荐', - '编辑', - '删除' + '<@shiro.hasPermission name="article:push">推送', + '<@shiro.hasPermission name="article:top">置顶', + '<@shiro.hasPermission name="article:recommend">推荐', + '<@shiro.hasPermission name="article:edit">编辑', + '<@shiro.hasPermission name="article:delete">删除' ]; return operateBtn.join(''); } diff --git a/blog-admin/src/main/resources/templates/article/tags.ftl b/blog-admin/src/main/resources/templates/article/tags.ftl index 76cd132bc46b0303b26fdd72a750d1f6c2670688..3afb582050b37c6317bae0f359a37426503dd6ce 100644 --- a/blog-admin/src/main/resources/templates/article/tags.ftl +++ b/blog-admin/src/main/resources/templates/article/tags.ftl @@ -11,12 +11,16 @@
@@ -71,8 +75,8 @@ function operateFormatter(code, row, index) { var trId = row.id; var operateBtn = [ - '编辑', - '删除' + '<@shiro.hasPermission name="tag:edit">编辑', + '<@shiro.hasPermission name="tag:delete">删除' ]; return operateBtn.join(''); } diff --git a/blog-admin/src/main/resources/templates/article/types.ftl b/blog-admin/src/main/resources/templates/article/types.ftl index 07934900c4bdbf04f110332f2ea35baad03f937b..e4947e192ee58666e83a5bf7ad6656a5c9da4318 100644 --- a/blog-admin/src/main/resources/templates/article/types.ftl +++ b/blog-admin/src/main/resources/templates/article/types.ftl @@ -11,12 +11,16 @@
@@ -135,8 +139,8 @@ function operateFormatter(code, row, index) { var trId = row.id; var operateBtn = [ - '编辑', - '删除' + '<@shiro.hasPermission name="type:edit">编辑', + '<@shiro.hasPermission name="type:delete">删除' ]; return operateBtn.join(''); } diff --git a/blog-admin/src/main/resources/templates/comment/list.ftl b/blog-admin/src/main/resources/templates/comment/list.ftl index df6552c3e66550557b5af371d3a3893434fb4ae6..ad6cf0f2ad6d8bd5a8d2731a3a6ecefbf8101a6b 100644 --- a/blog-admin/src/main/resources/templates/comment/list.ftl +++ b/blog-admin/src/main/resources/templates/comment/list.ftl @@ -11,9 +11,11 @@
@@ -112,9 +114,9 @@ var id = row.id; var sid = row.sid; var operateBtn = [ - '回复', - '审核', - '删除' + '<@shiro.hasPermission name="comment:reply">回复', + '<@shiro.hasPermission name="comment:audit">审核', + '<@shiro.hasPermission name="comment:delete">删除' ]; return operateBtn.join(''); } diff --git a/blog-admin/src/main/resources/templates/index.ftl b/blog-admin/src/main/resources/templates/index.ftl index 4af8f4960b198c2a465f7dd1a7e71cfe95527ec5..c1e615cd8385f7e86b844da6a77f0ad6a3f0dec5 100644 --- a/blog-admin/src/main/resources/templates/index.ftl +++ b/blog-admin/src/main/resources/templates/index.ftl @@ -9,107 +9,170 @@
-
-
-
-
-
-

最近发布

- 发布新文章 -
-
-
-
    - <@articleTag method="recentArticles"> - <#if recentArticles?? && recentArticles?size gt 0> - <#list recentArticles as item> -
  • - ${item.createTime?string('yyyy-MM-dd HH:mm')} - ${item.title} -
  • - - - -
-
+
+ <@shiro.hasPermission name="articles"> +
+
+
+

最近发布

+ <@shiro.hasPermission name="article:publish"> + 发布文章 + +
+
+
+
    + <@articleTag method="recentArticles"> + <#if recentArticles?? && recentArticles?size gt 0> + <#list recentArticles as item> +
  • + ${item.createTime?string('yyyy-MM-dd HH:mm')} + ${item.title} +
  • + + + +
-
-
-
-
-

近期评论

-
-
-
-
    - <@zhydTag method="recentComments"> - <#if recentComments?? && recentComments?size gt 0> - <#list recentComments as item> -
  • - ${item.nickname}: - ${item.briefContent?if_exists} -

    ${item.createTime?string('yyyy-MM-dd HH:mm')}

    -
  • - - <#else> -
  • 暂无评论
  • - - -
-
+ + <@shiro.hasPermission name="comments"> +
+
+
+

近期评论

+
+
+
+
    + <@zhydTag method="recentComments"> + <#if recentComments?? && recentComments?size gt 0> + <#list recentComments as item> +
  • + ${item.nickname}: + ${item.briefContent?if_exists} +

    ${item.createTime?string('yyyy-MM-dd HH:mm')}

    +
  • + + <#else> +
  • 暂无评论
  • + + +
+
-
-
-
-

系统日志

-
-
-
-
    -
  • -
    -
    - - 11月11日 - +
    +
    +
    +
    +

    系统日志

    +
    +
    +
    +
      +
    • +
      + +
      +

      + 更新说明 +

      + +
      +
      修改功能:
      +
        +
      1. 1. 完善shiro权限(数据库、页面)。注:需要重新执行下`sys_resources`和`sys_role_resources`两张表的`insert`语句
      2. +
      3. 2. redis配置默认不含密码(鉴于大多数朋友的redis都没有密码做此修改,不过本人 强烈建议设置下密码
      4. +
      +
      +
      -
      -

      - 上线说明 -

      -
    • +
    • +
      + +
      +

      + 更新说明 +

      + +
      +
      修复bug:
      +
        +
      1. 1. web端自动申请友链后不显示的问题
      2. +
      3. 2. config表修改后不能实时刷新的问题
      4. +
      +
      增加功能:
      +
        +
      1. 1. 网站赞赏码
      2. +
      3. 2. 百度推送功能(链接提交到百度站长平台)
      4. +
      +
      修改功能:
      +
        +
      1. 1. 百度api的ak和百度推送的token以及七牛云的配置改为通过config表管理
      2. +
      3. 2. admin模块菜单通过标签实时获取(链接提交到百度站长平台)
      4. +
      5. 2. 弹窗工具类js结构调整
      6. +
      +
      -

      上线了Read More -

      -
    -
  • -
  • -
  • +
  • +
    + +
    +

    + 上线说明 +

    + +

    上线了Read More +

    +
    -
    -

    - 更新说明 -

    -
  • +
  • +
    + +
    +

    + 更新说明 +

    + +

    列表页面的js代码提出为zyd.table.js公共代码

    +

    zyd.tool.js

    -

    列表页面的js代码提出为zyd.table.js公共代码

    -

    zyd.tool.js

    -
- - + + +
diff --git a/blog-admin/src/main/resources/templates/layout/setting.ftl b/blog-admin/src/main/resources/templates/layout/setting.ftl index 19d437779dab4ae840753a4ed1c779b01929d08f..fd97fe79ce1c65c80f58ff48e2586b7a571080c3 100644 --- a/blog-admin/src/main/resources/templates/layout/setting.ftl +++ b/blog-admin/src/main/resources/templates/layout/setting.ftl @@ -11,16 +11,17 @@ + <@shiro.hasPermission name="comments">