去除权限

This commit is contained in:
liuchengqian 2022-06-21 16:52:18 +08:00
parent e258f92e27
commit 5550177277
4 changed files with 16 additions and 33 deletions

View File

@ -1,8 +1,6 @@
package com.xkrs.controller; package com.xkrs.controller;
import com.xkrs.service.FireAndRangerService; import com.xkrs.service.FireAndRangerService;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -20,11 +18,11 @@ public class FireAndRangerController {
/** /**
* 将火点分配给某个人 * 将火点分配给某个人
*
* @param map * @param map
* @param token * @param token
* @return * @return
*/ */
@PreAuthorize("hasAnyAuthority('auth_general_user')")
@PostMapping("/addFireAndRanger") @PostMapping("/addFireAndRanger")
public String addFireAndRanger(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) throws UnsupportedEncodingException { public String addFireAndRanger(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) throws UnsupportedEncodingException {
String rangerName = (String) map.get("rangerName"); String rangerName = (String) map.get("rangerName");
@ -36,10 +34,10 @@ public class FireAndRangerController {
/** /**
* 护林员查看自己的火点任务 * 护林员查看自己的火点任务
*
* @param token * @param token
* @return * @return
*/ */
@PreAuthorize("hasAnyAuthority('auth_rangers')")
@GetMapping("/selectFireInformation") @GetMapping("/selectFireInformation")
public String selectFireInformation(@RequestHeader(value = "Authorization") String token) { public String selectFireInformation(@RequestHeader(value = "Authorization") String token) {
return fireAndRangerService.selectFireInformation(token); return fireAndRangerService.selectFireInformation(token);
@ -47,10 +45,10 @@ public class FireAndRangerController {
/** /**
* 根据火点编码查询核查信息 * 根据火点编码查询核查信息
*
* @param map * @param map
* @return * @return
*/ */
@PreAuthorize("hasAnyAuthority('auth_general_user')")
@PostMapping("/findFireAndRanger") @PostMapping("/findFireAndRanger")
public String findFireAndRangerByFireCode(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) throws Exception { public String findFireAndRangerByFireCode(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) throws Exception {
String fireCode = (String) map.get("fireCode"); String fireCode = (String) map.get("fireCode");

View File

@ -19,7 +19,6 @@ import org.apache.hc.core5.util.TextUtils;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -184,7 +183,6 @@ public class FirePointController {
* @return * @return
*/ */
@GetMapping("/selectUserName") @GetMapping("/selectUserName")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String selectUserName(@RequestHeader(value = "Authorization") String token) { public String selectUserName(@RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -204,7 +202,6 @@ public class FirePointController {
* @return * @return
*/ */
@GetMapping("/selectTodayFirePoint") @GetMapping("/selectTodayFirePoint")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) { public String selectTodayFirePoint(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -219,7 +216,6 @@ public class FirePointController {
* 动态多条件查询火点信息 * 动态多条件查询火点信息
*/ */
@PostMapping("/selectFirePoint") @PostMapping("/selectFirePoint")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String selectFirePoint(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String selectFirePoint(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -304,7 +300,6 @@ public class FirePointController {
* 查询近一个月的火点信息 * 查询近一个月的火点信息
*/ */
@GetMapping("/selectFirePointByMonth") @GetMapping("/selectFirePointByMonth")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String selectFirePointByMonth(@RequestHeader(value = "Authorization") String token) { public String selectFirePointByMonth(@RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();

View File

@ -1,7 +1,6 @@
package com.xkrs.controller; package com.xkrs.controller;
import com.xkrs.service.ForestRangerService; import com.xkrs.service.ForestRangerService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -18,34 +17,34 @@ public class ForestRangerController {
/** /**
* 根据区县编码查询相关护林员的信息 * 根据区县编码查询相关护林员的信息
*
* @param rangerCountyCode * @param rangerCountyCode
* @return * @return
*/ */
@GetMapping("/findByRangerCountyCode") @GetMapping("/findByRangerCountyCode")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode, @RequestHeader(value = "Authorization") String token) { public String findByRangerCountyCode(@RequestParam("rangerCountyCode") String rangerCountyCode, @RequestHeader(value = "Authorization") String token) {
return forestRangerService.findByRangerCountyCode(rangerCountyCode); return forestRangerService.findByRangerCountyCode(rangerCountyCode);
} }
/** /**
* 根据区县编码查询该区县所有护林员的信息 * 根据区县编码查询该区县所有护林员的信息
*
* @param countyCode * @param countyCode
* @param token * @param token
* @return * @return
*/ */
@GetMapping("/findAllByRangerCountyCode") @GetMapping("/findAllByRangerCountyCode")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) { public String findAllByRangerCountyCode(@RequestParam("countyCode") String countyCode, @RequestHeader(value = "Authorization") String token) {
return forestRangerService.findAllByRangerCountyCode(countyCode, token); return forestRangerService.findAllByRangerCountyCode(countyCode, token);
} }
/** /**
* 根据手机号修改护林员的位置 * 根据手机号修改护林员的位置
*
* @param map * @param map
* @return * @return
*/ */
@PostMapping("/updateLatAndLonByPhone") @PostMapping("/updateLatAndLonByPhone")
@PreAuthorize("hasAnyAuthority('auth_general_user')")
public String updateLatAndLonByPhone(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String updateLatAndLonByPhone(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
String rangerLatitude = (String) map.get("rangerLatitude"); String rangerLatitude = (String) map.get("rangerLatitude");
String rangerLongitude = (String) map.get("rangerLongitude"); String rangerLongitude = (String) map.get("rangerLongitude");

View File

@ -17,7 +17,6 @@ import com.xkrs.service.RedisService;
import com.xkrs.service.SysUserService; import com.xkrs.service.SysUserService;
import com.xkrs.utils.RandomUtil; import com.xkrs.utils.RandomUtil;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -179,7 +178,6 @@ public class SysUserController {
* @return * @return
*/ */
@RequestMapping(value = "/general/delete", method = RequestMethod.DELETE) @RequestMapping(value = "/general/delete", method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')")
public String deleteCustomUser(@RequestParam(value = "userId", required = false) int id) { public String deleteCustomUser(@RequestParam(value = "userId", required = false) int id) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -193,7 +191,6 @@ public class SysUserController {
} }
@RequestMapping(value = "/update", method = RequestMethod.POST) @RequestMapping(value = "/update", method = RequestMethod.POST)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_administor')")
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) { public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -233,7 +230,6 @@ public class SysUserController {
* @return * @return
*/ */
@GetMapping("/selectAllUser") @GetMapping("/selectAllUser")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String selectAllUser(@RequestHeader(value = "Authorization") String token) { public String selectAllUser(@RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -258,7 +254,6 @@ public class SysUserController {
* @return * @return
*/ */
@PostMapping("/operateActiveFlag") @PostMapping("/operateActiveFlag")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String operateActiveFlag(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String operateActiveFlag(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
Integer userId = (Integer) map.get("userId"); Integer userId = (Integer) map.get("userId");
String keepType = (String) map.get("keepType"); String keepType = (String) map.get("keepType");
@ -288,7 +283,6 @@ public class SysUserController {
* @return * @return
*/ */
@PostMapping("/updatePassword") @PostMapping("/updatePassword")
@PreAuthorize("hasAnyAuthority('auth_administor','auth_general_user')")
public String updatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String updatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -312,7 +306,6 @@ public class SysUserController {
* @return * @return
*/ */
@PostMapping("/adminUpdatePassword") @PostMapping("/adminUpdatePassword")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String adminUpdatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String adminUpdatePassword(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -420,7 +413,6 @@ public class SysUserController {
* @return * @return
*/ */
@PostMapping("/updateExpireDate") @PostMapping("/updateExpireDate")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String updateExpireDate(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String updateExpireDate(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
Integer userId = (Integer) map.get("userId"); Integer userId = (Integer) map.get("userId");
Integer timeNum = (Integer) map.get("timeNum"); Integer timeNum = (Integer) map.get("timeNum");
@ -444,7 +436,6 @@ public class SysUserController {
* @return * @return
*/ */
@PostMapping("/updateOverTime") @PostMapping("/updateOverTime")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String updateOverTime(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { public String updateOverTime(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) {
Integer userId = (Integer) map.get("userId"); Integer userId = (Integer) map.get("userId");
String overTime = (String) map.get("overTime"); String overTime = (String) map.get("overTime");