Browse Source

优化用户不能删除自己

pull/319/head
RuoYi 3 years ago
parent
commit
ef41439260
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -20,6 +21,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
@ -239,6 +241,10 @@ public class SysUserController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(ids));
}

Loading…
Cancel
Save