Browse Source

内容管理加权限

zouxuan 4 years ago
parent
commit
741a28894f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

+ 4 - 0
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -10,6 +10,7 @@ import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -100,6 +101,7 @@ public class NewsController extends BaseController {
 	@ApiOperation("新增资讯")
 	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@AuditLogAnnotation(operateName = "资讯新增",interfaceURL = "news/add")
+	@PreAuthorize("@pcs.hasPermissions('news/add')")
 	public Object add(SysNewsInformation newsInfo) {
 		return succeed(sysNewsInformationService.insert(newsInfo));
 	}
@@ -107,6 +109,7 @@ public class NewsController extends BaseController {
 	@ApiOperation("更新资讯")
 	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@AuditLogAnnotation(operateName = "资讯更新",interfaceURL = "news/update")
+	@PreAuthorize("@pcs.hasPermissions('news/update')")
 	public Object update(SysNewsInformation newsInfo) {
 		Date date = new Date();
 		newsInfo.setUpdateTime(date);
@@ -117,6 +120,7 @@ public class NewsController extends BaseController {
 	@ApiOperation("删除")
 	@PostMapping(value = "/del/{id}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@AuditLogAnnotation(operateName = "资讯删除",interfaceURL = "news/del")
+	@PreAuthorize("@pcs.hasPermissions('news/del')")
 	public Object add(@PathVariable("id") Long id) {
 		return succeed(sysNewsInformationService.deleteWithLogical(id));
 	}