Merge pull request #5455 from dataease/pr@dev@perf_user_api

perf(用户管理): 删除无用api
This commit is contained in:
fit2cloud-chenyw 2023-06-15 13:56:47 +08:00 committed by GitHub
commit 0648c62b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,31 +4,28 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DeLog; import io.dataease.auth.annotation.DeLog;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.SqlInjectValidator; import io.dataease.auth.annotation.SqlInjectValidator;
import io.dataease.auth.api.dto.CurrentUserDto; import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.entity.AccountLockStatus; import io.dataease.auth.entity.AccountLockStatus;
import io.dataease.auth.service.AuthUserService; import io.dataease.auth.service.AuthUserService;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.ResourceAuthLevel;
import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.exception.DEException; import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.sys.request.KeyGridRequest;
import io.dataease.controller.sys.response.AuthBindDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysRole;
import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager; import io.dataease.commons.utils.Pager;
import io.dataease.controller.response.ExistLdapUser; import io.dataease.controller.response.ExistLdapUser;
import io.dataease.controller.sys.base.BaseGridRequest; import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.request.KeyGridRequest;
import io.dataease.controller.sys.request.SysUserCreateRequest; import io.dataease.controller.sys.request.SysUserCreateRequest;
import io.dataease.controller.sys.request.SysUserPwdRequest; import io.dataease.controller.sys.request.SysUserPwdRequest;
import io.dataease.controller.sys.request.SysUserStateRequest; import io.dataease.controller.sys.request.SysUserStateRequest;
import io.dataease.controller.sys.response.AuthBindDTO;
import io.dataease.controller.sys.response.RoleUserItem; import io.dataease.controller.sys.response.RoleUserItem;
import io.dataease.controller.sys.response.SysUserGridResponse; import io.dataease.controller.sys.response.SysUserGridResponse;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.plugins.common.base.domain.SysRole;
import io.dataease.plugins.common.base.domain.SysUser; import io.dataease.plugins.common.base.domain.SysUser;
import io.dataease.plugins.common.base.domain.SysUserAssist; import io.dataease.plugins.common.base.domain.SysUserAssist;
import io.dataease.service.sys.SysRoleService; import io.dataease.service.sys.SysRoleService;
@ -37,7 +34,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -87,27 +84,22 @@ public class SysUserController {
users.forEach(user -> { users.forEach(user -> {
AccountLockStatus accountLockStatus = authUserService.lockStatus(user.getUsername(), user.getFrom()); AccountLockStatus accountLockStatus = authUserService.lockStatus(user.getUsername(), user.getFrom());
user.setLocked(accountLockStatus.getLocked()); user.setLocked(accountLockStatus.getLocked());
user.setPassword(null);
}); });
return PageUtils.setPageInfo(page, users); return PageUtils.setPageInfo(page, users);
} }
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
@PostMapping("/userGrid/{datasetId}")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "request", value = "查询条件", required = true)
})
public Pager<List<SysUserGridResponse>> userGrids(@PathVariable String datasetId, @RequestBody KeyGridRequest request) {
return userGrid(0, 0, request);
}
@ApiIgnore @ApiIgnore
@PostMapping("/userLists") @PostMapping("/userLists")
@SqlInjectValidator({"nick_name", "create_time"}) @SqlInjectValidator({"nick_name", "create_time"})
public List<SysUserGridResponse> userLists(@RequestBody BaseGridRequest request) { public List<SysUserGridResponse> userLists(@RequestBody BaseGridRequest request) {
KeyGridRequest keyGridRequest = BeanUtils.copyBean(new KeyGridRequest(), request); KeyGridRequest keyGridRequest = BeanUtils.copyBean(new KeyGridRequest(), request);
return sysUserService.query(keyGridRequest); List<SysUserGridResponse> users = sysUserService.query(keyGridRequest);
if (CollectionUtils.isEmpty(users)) return users;
users.forEach(user -> {
user.setPassword(null);
});
return users;
} }
@ApiOperation("创建用户") @ApiOperation("创建用户")