licailing 3 år sedan
förälder
incheckning
7ab9c82a96

+ 1 - 0
src/main/java/com/izouma/nineth/enums/AuthorityName.java

@@ -6,6 +6,7 @@ public enum AuthorityName {
     ROLE_DEV("开发者"),
     ROLE_ADMIN("高级管理员"),
     ROLE_OPERATOR("普通管理员"),
+    ROLE_NEWS("新闻管理员")
     ;
     private final String description;
 

+ 2 - 1
src/main/java/com/izouma/nineth/web/NewsController.java

@@ -29,7 +29,7 @@ public class NewsController extends BaseController {
     private NewsRepo     newsRepo;
     private NewsLikeRepo newsLikeRepo;
 
-    @PreAuthorize("hasRole('ADMIN')")
+    @PreAuthorize("hasAnyRole('ADMIN','NEWS')")
     @PostMapping("/save")
     public News save(@RequestBody News record) {
         if (record.getId() != null) {
@@ -60,6 +60,7 @@ public class NewsController extends BaseController {
         return news;
     }
 
+    @PreAuthorize("hasAnyRole('ADMIN','NEWS')")
     @PostMapping("/del/{id}")
     public void del(@PathVariable Long id) {
         newsRepo.softDelete(id);

+ 2 - 0
src/main/vue/src/views/AdminEdit.vue

@@ -50,6 +50,8 @@
                             </el-option>
                             <el-option label="普通管理员" :value="{ name: 'ROLE_OPERATOR', description: '普通管理员' }">
                             </el-option>
+                            <el-option label="新闻管理员" :value="{ name: 'ROLE_NEWS', description: '新闻管理员' }">
+                            </el-option>
                         </el-select>
                     </el-form-item>
                     <el-form-item>

+ 1 - 1
src/main/vue/src/views/MenuAuthority.vue

@@ -80,7 +80,7 @@ export default {
                     return this.$http.get('/authority/all');
                 })
                 .then(res => {
-                    this.authorities = res.filter(i => i.name === 'ROLE_ADMIN' || i.name === 'ROLE_OPERATOR');
+                    this.authorities = res.filter(i => i.name === 'ROLE_ADMIN' || i.name === 'ROLE_OPERATOR' || i.name === 'ROLE_NEWS');
                     if (!this.authority && res[0]) {
                         this.authority = res[0].name;
                     }