Commit 3f105f6ec7b0a2281628773f99b440cc675878d2
1 parent
c00a4b8c
审核云越权漏洞
Showing
4 changed files
with
35 additions
and
16 deletions
src/main/java/com/cnlive/shenhe/controller/AudioController.java
| @@ -241,8 +241,17 @@ public class AudioController extends BaseController { | @@ -241,8 +241,17 @@ public class AudioController extends BaseController { | ||
| 241 | * @return | 241 | * @return |
| 242 | */ | 242 | */ |
| 243 | @GetMapping("/details") | 243 | @GetMapping("/details") |
| 244 | - public Object getDetailsAudio(Model model, Integer id) { | ||
| 245 | - ShyAudio shyAudio = audioService.getDetailsAudio(id); | 244 | + public Object getDetailsAudio(Model model, Integer id, HttpSession session) { |
| 245 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 246 | + if (CommonUtils.isNull(sessionUser)) { | ||
| 247 | + return "redirect:/users/login"; | ||
| 248 | + } | ||
| 249 | + Integer spid = sessionUser.getSpid(); | ||
| 250 | + logger.info("音频获取spId:{}", spid); | ||
| 251 | + ShyAudio shyAudio = audioService.getDetailsAudio(id, spid); | ||
| 252 | + if (CommonUtils.isNull(shyAudio)) { | ||
| 253 | + return "page/error.html"; | ||
| 254 | + } | ||
| 246 | Object images = JSON.parse(shyAudio.getAudioCoverUrl()); | 255 | Object images = JSON.parse(shyAudio.getAudioCoverUrl()); |
| 247 | 256 | ||
| 248 | String yuming = ""; | 257 | String yuming = ""; |
src/main/java/com/cnlive/shenhe/service/AudioService.java
| @@ -117,7 +117,7 @@ public interface AudioService { | @@ -117,7 +117,7 @@ public interface AudioService { | ||
| 117 | * @param id | 117 | * @param id |
| 118 | * @return | 118 | * @return |
| 119 | */ | 119 | */ |
| 120 | - ShyAudio getDetailsAudio(Integer id); | 120 | + ShyAudio getDetailsAudio(Integer id,Integer spid); |
| 121 | 121 | ||
| 122 | /** | 122 | /** |
| 123 | * 根据条件导出数据excel | 123 | * 根据条件导出数据excel |
src/main/java/com/cnlive/shenhe/service/serviceImpl/AudioServiceImpl.java
| 1 | package com.cnlive.shenhe.service.serviceImpl; | 1 | package com.cnlive.shenhe.service.serviceImpl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.cnlive.shenhe.bean.ErrorEnum; | 5 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | import com.cnlive.shenhe.bean.ResponseBean; | 6 | import com.cnlive.shenhe.bean.ResponseBean; |
| @@ -321,19 +322,28 @@ public class AudioServiceImpl implements AudioService { | @@ -321,19 +322,28 @@ public class AudioServiceImpl implements AudioService { | ||
| 321 | } | 322 | } |
| 322 | 323 | ||
| 323 | @Override | 324 | @Override |
| 324 | - public ShyAudio getDetailsAudio(Integer id) { | ||
| 325 | - ShyAudio shyAudio = shyAudioMapper.selectByPrimaryKey(id); | ||
| 326 | - if (!shyAudio.getState().equals(CommonConst.AUDIT_INTT)) { | ||
| 327 | - String updater = CommonUtils.isEmpty(shyAudio.getUploader()) || "null".equals(shyAudio.getUploader()) ? "白名单" : shyAudio.getUploader(); | ||
| 328 | - String auditorId = shyAudio.getAuditor_id(); | ||
| 329 | - if (CommonUtils.isNotEmpty(auditorId)) { | ||
| 330 | - ShyUsers user = new ShyUsers(); | ||
| 331 | - user.setUser_id(auditorId); | ||
| 332 | - user = shyUsersMapper.selectOne(user); | ||
| 333 | - String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail(); | ||
| 334 | - updater = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername(); | 325 | + public ShyAudio getDetailsAudio(Integer id, Integer spid) { |
| 326 | + ShyAudio audio = new ShyAudio(); | ||
| 327 | + audio.setId(id); | ||
| 328 | + if (spid != 0) { | ||
| 329 | + audio.setSpId(spid); | ||
| 330 | + } | ||
| 331 | + //ShyAudio shyAudio = shyAudioMapper.selectByPrimaryKey(id); | ||
| 332 | + ShyAudio shyAudio = shyAudioMapper.selectByPrimaryKey(audio); | ||
| 333 | + logger.info("查询音频实体参数:{}", JSON.toJSON(shyAudio)); | ||
| 334 | + if (CommonUtils.isNotNull(shyAudio)) { | ||
| 335 | + if (!shyAudio.getState().equals(CommonConst.AUDIT_INTT)) { | ||
| 336 | + String updater = CommonUtils.isEmpty(shyAudio.getUploader()) || "null".equals(shyAudio.getUploader()) ? "白名单" : shyAudio.getUploader(); | ||
| 337 | + String auditorId = shyAudio.getAuditor_id(); | ||
| 338 | + if (CommonUtils.isNotEmpty(auditorId)) { | ||
| 339 | + ShyUsers user = new ShyUsers(); | ||
| 340 | + user.setUser_id(auditorId); | ||
| 341 | + user = shyUsersMapper.selectOne(user); | ||
| 342 | + String email = CommonUtils.isEmpty(user.getEmail()) || "null".equals(user.getEmail()) ? "" : user.getEmail(); | ||
| 343 | + updater = CommonUtils.isEmpty(user.getUsername()) ? email : user.getUsername(); | ||
| 344 | + } | ||
| 345 | + shyAudio.setUploader(updater); | ||
| 335 | } | 346 | } |
| 336 | - shyAudio.setUploader(updater); | ||
| 337 | } | 347 | } |
| 338 | return shyAudio; | 348 | return shyAudio; |
| 339 | } | 349 | } |
src/main/java/com/cnlive/shenhe/service/serviceImpl/ContentServiceImpl.java
| @@ -91,7 +91,7 @@ public class ContentServiceImpl implements ContentService { | @@ -91,7 +91,7 @@ public class ContentServiceImpl implements ContentService { | ||
| 91 | criteria.andEqualTo("receive_status", CommonConst.RECEIVE_BEFORE); | 91 | criteria.andEqualTo("receive_status", CommonConst.RECEIVE_BEFORE); |
| 92 | List<ShyContent> shyContents = shyContentMapper.selectByExampleAndRowBounds(example, new RowBounds(0, 100)); | 92 | List<ShyContent> shyContents = shyContentMapper.selectByExampleAndRowBounds(example, new RowBounds(0, 100)); |
| 93 | for (ShyContent shyContent : shyContents) { | 93 | for (ShyContent shyContent : shyContents) { |
| 94 | - logger.info("contentId:{}" + shyContent.getContent_id()); | 94 | + logger.info("contentId:{}", shyContent.getContent_id()); |
| 95 | } | 95 | } |
| 96 | return shyContents; | 96 | return shyContents; |
| 97 | } | 97 | } |