!90 【轻量级PR】SysUserController remove 解决把自己删除的bug

Merge pull request !90 from dazer007/secerity-fix-remove-self-ok
pull/91/MERGE
若依 3 years ago committed by Gitee
commit 04edd66199

@ -5,6 +5,8 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
@ -217,6 +219,9 @@ public class SysUserController extends BaseController
@DeleteMapping("/{userIds}") @DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) public AjaxResult remove(@PathVariable Long[] userIds)
{ {
if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) {
return AjaxResult.error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds)); return toAjax(userService.deleteUserByIds(userIds));
} }

Loading…
Cancel
Save