Ver Fonte

首页权限控制

WXF há 2 anos atrás
pai
commit
eeaf700f0b

+ 5 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/home/ctrl/HomePageCtrl.java

@@ -12,6 +12,7 @@ import com.css.simulation.resource.system.service.ClusterService;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -104,6 +105,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectHardware")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<HardwareVO> selectHardware() {
         return homePageService.selectHardware();
     }
@@ -113,6 +115,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectService")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<ServiceVO> selectService() {
         return homePageService.selectService();
     }
@@ -122,6 +125,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectAccess")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<List<LineChartVO>> selectAccess() {
         List<LineChartVO> list = homePageService.selectAccess();
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,list);
@@ -133,6 +137,7 @@ public class HomePageCtrl {
      */
     @RequestMapping("selectServer")
     @ResponseBody
+    @PreAuthorize("@AuthorityCheck.admin()")
     public ResponseBodyVO<PageInfo<SystemServerVO>> selectServer(PageVO pageVO) {
         return homePageService.selectServer(pageVO);
     }