forked from github/dataease
Merge remote-tracking branch 'origin/v1.8' into v1.8
This commit is contained in:
commit
d9d96f01af
@ -1,6 +1,5 @@
|
||||
package io.dataease.controller.sys;
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
@ -49,27 +48,33 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:read")
|
||||
@PostMapping("/userGrid/{goPage}/{pageSize}")
|
||||
@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)
|
||||
@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>> userGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
|
||||
public Pager<List<SysUserGridResponse>> userGrid(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody BaseGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, sysUserService.query(request));
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
@PostMapping("/userLists")
|
||||
public List<SysUserGridResponse> userLists(@RequestBody BaseGridRequest request) {
|
||||
return sysUserService.query(request);
|
||||
}
|
||||
|
||||
@ApiOperation("创建用户")
|
||||
@RequiresPermissions("user:add")
|
||||
@PostMapping("/create")
|
||||
public void create(@RequestBody SysUserCreateRequest request){
|
||||
public void create(@RequestBody SysUserCreateRequest request) {
|
||||
sysUserService.save(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@RequiresPermissions("user:edit")
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody SysUserCreateRequest request){
|
||||
public void update(@RequestBody SysUserCreateRequest request) {
|
||||
sysUserService.update(request);
|
||||
}
|
||||
|
||||
@ -77,33 +82,32 @@ public class SysUserController {
|
||||
@RequiresPermissions("user:del")
|
||||
@PostMapping("/delete/{userId}")
|
||||
@ApiImplicitParam(paramType = "path", value = "用户ID", name = "userId", required = true, dataType = "Integer")
|
||||
public void delete(@PathVariable("userId") Long userId){
|
||||
public void delete(@PathVariable("userId") Long userId) {
|
||||
sysUserService.delete(userId);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("更新用户状态")
|
||||
@RequiresPermissions("user:edit")
|
||||
@RequiresRoles("1")
|
||||
@PostMapping("/updateStatus")
|
||||
public void updateStatus(@RequestBody SysUserStateRequest request){
|
||||
public void updateStatus(@RequestBody SysUserStateRequest request) {
|
||||
sysUserService.updateStatus(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新当前用户密码")
|
||||
@PostMapping("/updatePwd")
|
||||
public void updatePwd(@RequestBody SysUserPwdRequest request){
|
||||
public void updatePwd(@RequestBody SysUserPwdRequest request) {
|
||||
|
||||
sysUserService.updatePwd(request);
|
||||
}
|
||||
|
||||
@ApiOperation("更新指定用户密码")
|
||||
@RequiresPermissions("user:editPwd")
|
||||
@PostMapping("/adminUpdatePwd")
|
||||
public void adminUpdatePwd(@RequestBody SysUserPwdRequest request){
|
||||
public void adminUpdatePwd(@RequestBody SysUserPwdRequest request) {
|
||||
sysUserService.adminUpdatePwd(request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("当前用户信息")
|
||||
@PostMapping("/personInfo")
|
||||
public CurrentUserDto personInfo() {
|
||||
@ -114,13 +118,13 @@ public class SysUserController {
|
||||
@ApiIgnore
|
||||
@ApiOperation("更新个人信息")
|
||||
@PostMapping("/updatePersonInfo")
|
||||
public void updatePersonInfo(@RequestBody SysUserCreateRequest request){
|
||||
public void updatePersonInfo(@RequestBody SysUserCreateRequest request) {
|
||||
sysUserService.updatePersonInfo(request);
|
||||
}
|
||||
|
||||
@ApiOperation("设置语言")
|
||||
@PostMapping("/setLanguage/{language}")
|
||||
@ApiImplicitParam(paramType="path", name = "language", value = "语言(zh_CN, zh_TW, en_US)", required = true, dataType = "String")
|
||||
@ApiImplicitParam(paramType = "path", name = "language", value = "语言(zh_CN, zh_TW, en_US)", required = true, dataType = "String")
|
||||
public void setLanguage(@PathVariable String language) {
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
Optional.ofNullable(language).ifPresent(currentLanguage -> {
|
||||
@ -132,28 +136,24 @@ public class SysUserController {
|
||||
|
||||
@ApiOperation("查询所有角色")
|
||||
@PostMapping("/all")
|
||||
public List<RoleUserItem> all(){
|
||||
public List<RoleUserItem> all() {
|
||||
return sysRoleService.allRoles();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@ApiIgnore("查询角色")
|
||||
@PostMapping("/roleGrid/{goPage}/{pageSize}")
|
||||
@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)
|
||||
@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<SysRole>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
|
||||
public Pager<List<SysRole>> roleGrid(@PathVariable int goPage, @PathVariable int pageSize,
|
||||
@RequestBody BaseGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
Pager<List<SysRole>> listPager = PageUtils.setPageInfo(page, sysRoleService.query(request));
|
||||
return listPager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation("已同步用户")
|
||||
@PostMapping("/existLdapUsers")
|
||||
public List<ExistLdapUser> getExistLdapUsers() {
|
||||
|
@ -1705,7 +1705,7 @@ public class ChartViewService {
|
||||
throw new RuntimeException(Translator.get("i18n_dataset_delete"));
|
||||
}
|
||||
SysUserEntity user = AuthUtils.getUser();
|
||||
user = user != null ? user : authUserService.getUserById(userId);
|
||||
user = userId != null ? authUserService.getUserById(userId) : user;
|
||||
if (!user.getIsAdmin()) {
|
||||
if (ObjectUtils.isEmpty(table.getPrivileges()) || !table.getPrivileges().contains(needPermission)) {
|
||||
throw new RuntimeException(Translator.get("i18n_dataset_no_permission"));
|
||||
|
@ -405,8 +405,7 @@ public class DataSetTableService {
|
||||
|
||||
public DataSetTableDTO getWithPermission(String id, Long user) {
|
||||
CurrentUserDto currentUserDto = AuthUtils.getUser();
|
||||
Long userId = currentUserDto != null ? currentUserDto.getUserId() : user;
|
||||
|
||||
Long userId = user != null ? user : currentUserDto.getUserId();
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
dataSetTableRequest.setId(id);
|
||||
dataSetTableRequest.setUserId(String.valueOf(userId));
|
||||
|
@ -94,37 +94,19 @@ public class PermissionService {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
RowPermissionService rowPermissionService = SpringContextUtil.getBean(RowPermissionService.class);
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
SysUserEntity userEntity = userId != null ? authUserService.getUserById(userId) : AuthUtils.getUser();
|
||||
List<Long> roleIds = new ArrayList<>();
|
||||
Long deptId = null;
|
||||
|
||||
if (user == null && userId == null) {
|
||||
if (userEntity == null ) {
|
||||
return datasetRowPermissions;
|
||||
}
|
||||
|
||||
if (user != null && userId != null) {
|
||||
if (userEntity.getIsAdmin()) {
|
||||
return datasetRowPermissions;
|
||||
}
|
||||
|
||||
if (user != null) {
|
||||
if (user.getIsAdmin()) {
|
||||
return datasetRowPermissions;
|
||||
}
|
||||
userId = user.getUserId();
|
||||
deptId = user.getDeptId();
|
||||
roleIds = user.getRoles().stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (userId != null) {
|
||||
SysUserEntity userEntity = authUserService.getUserById(userId);
|
||||
if (userEntity.getIsAdmin()) {
|
||||
return datasetRowPermissions;
|
||||
}
|
||||
deptId = userEntity.getDeptId();
|
||||
roleIds = authUserService.roles(userId).stream().map(r -> Long.valueOf(r)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
userId = userEntity.getUserId();
|
||||
deptId = userEntity.getDeptId();
|
||||
roleIds = authUserService.roles(userId).stream().map(r -> Long.valueOf(r)).collect(Collectors.toList());
|
||||
DataSetRowPermissionsDTO dataSetRowPermissionsDTO = new DataSetRowPermissionsDTO();
|
||||
dataSetRowPermissionsDTO.setDatasetId(datasetId);
|
||||
dataSetRowPermissionsDTO.setAuthTargetIds(Collections.singletonList(userId));
|
||||
@ -146,36 +128,19 @@ public class PermissionService {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
ColumnPermissionService columnPermissionService = SpringContextUtil.getBean(ColumnPermissionService.class);
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
SysUserEntity userEntity = userId != null ? authUserService.getUserById(userId) : AuthUtils.getUser();
|
||||
List<Long> roleIds = new ArrayList<>();
|
||||
Long deptId = null;
|
||||
|
||||
if (user == null && userId == null) {
|
||||
if (userEntity == null ) {
|
||||
return datasetColumnPermissions;
|
||||
}
|
||||
|
||||
if (user != null && userId != null) {
|
||||
if (userEntity.getIsAdmin()) {
|
||||
return datasetColumnPermissions;
|
||||
}
|
||||
|
||||
if (user != null) {
|
||||
if (user.getIsAdmin()) {
|
||||
return datasetColumnPermissions;
|
||||
}
|
||||
userId = user.getUserId();
|
||||
deptId = user.getDeptId();
|
||||
roleIds = user.getRoles().stream().map(CurrentRoleDto::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if (userId != null) {
|
||||
SysUserEntity userEntity = authUserService.getUserById(userId);
|
||||
if (userEntity.getIsAdmin()) {
|
||||
return datasetColumnPermissions;
|
||||
}
|
||||
deptId = userEntity.getDeptId();
|
||||
roleIds = authUserService.roles(userId).stream().map(r -> Long.valueOf(r)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
userId = userEntity.getUserId();
|
||||
deptId = userEntity.getDeptId();
|
||||
roleIds = authUserService.roles(userId).stream().map(r -> Long.valueOf(r)).collect(Collectors.toList());
|
||||
DataSetColumnPermissionsDTO dataSetColumnPermissionsDTO = new DataSetColumnPermissionsDTO();
|
||||
dataSetColumnPermissionsDTO.setDatasetId(datasetId);
|
||||
dataSetColumnPermissionsDTO.setAuthTargetIds(Collections.singletonList(userId));
|
||||
|
@ -4,6 +4,7 @@ const pathMap = {
|
||||
personInfoPath: '/api/user/personInfo/',
|
||||
piupdatePath: '/api/user/updatePersonInfo/',
|
||||
queryPath: '/api/user/userGrid/',
|
||||
queryWithOutPagePath: '/api/user/userLists',
|
||||
deletePath: '/api/user/delete/',
|
||||
createPath: '/api/user/create',
|
||||
updatePath: '/api/user/update',
|
||||
@ -19,6 +20,15 @@ export function userLists(page, size, data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function userListsWithOutPage(data) {
|
||||
return request({
|
||||
url: pathMap.queryWithOutPagePath,
|
||||
method: 'post',
|
||||
data,
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
export const addUser = (data) => {
|
||||
return request({
|
||||
url: pathMap.createPath,
|
||||
|
@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userLists } from '@/api/system/user'
|
||||
import { userListsWithOutPage } from '@/api/system/user'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { loadShares } from '@/api/panel/share'
|
||||
/* import { saveShare, loadShares } from '@/api/panel/share' */
|
||||
@ -69,10 +69,10 @@ export default {
|
||||
search(condition) {
|
||||
const temp = formatCondition(condition)
|
||||
const param = temp || {}
|
||||
userLists(1, 0, param).then(response => {
|
||||
userListsWithOutPage(param).then(response => {
|
||||
const data = response.data
|
||||
this.data = data.listObject.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.tableData = data.listObject.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.data = data.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.tableData = data.filter(ele => ele.id !== this.$store.getters.user.userId)
|
||||
this.queryShareNodeIds()
|
||||
})
|
||||
},
|
||||
|
@ -588,6 +588,9 @@ export default {
|
||||
this.$message.error(i18n.t('datasource.api_table_not_empty'))
|
||||
return
|
||||
}
|
||||
form.apiConfiguration.forEach(item =>{
|
||||
delete item.status
|
||||
})
|
||||
form.configuration = JSON.stringify(form.apiConfiguration)
|
||||
}else {
|
||||
form.configuration = JSON.stringify(form.configuration)
|
||||
|
Loading…
Reference in New Issue
Block a user