fix(系统设置): 组织列表移除用户不展示
This commit is contained in:
parent
5eed64f4ba
commit
c5982c8424
|
@ -98,7 +98,15 @@ public class PermissionConstants {
|
||||||
|
|
||||||
/*------ end: SYSTEM_PARAMETER_SETTING ------*/
|
/*------ end: SYSTEM_PARAMETER_SETTING ------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目成员权限
|
||||||
|
*/
|
||||||
|
/*------ start: PROJECT_MEMBER ------*/
|
||||||
|
public static final String PROJECT_MEMBER_READ = "PROJECT_MEMBER:READ";
|
||||||
|
public static final String PROJECT_MEMBER_ADD = "PROJECT_MEMBER:READ+ADD";
|
||||||
|
public static final String PROJECT_MEMBER_UPDATE = "PROJECT_MEMBER:READ+UPDATE";
|
||||||
|
public static final String PROJECT_MEMBER_DELETE = "PROJECT_MEMBER:READ+DELETE";
|
||||||
|
/*------ end: PROJECT_MEMBER ------*/
|
||||||
|
|
||||||
public static final String SYSTEM_QUOTA_READ = "SYSTEM_QUOTA:READ";
|
public static final String SYSTEM_QUOTA_READ = "SYSTEM_QUOTA:READ";
|
||||||
public static final String SYSTEM_QUOTA_READ_UPDATE = "SYSTEM_QUOTA:READ+UPDATE";
|
public static final String SYSTEM_QUOTA_READ_UPDATE = "SYSTEM_QUOTA:READ+UPDATE";
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<select id="list" resultType="io.metersphere.system.dto.OrganizationDTO">
|
<select id="list" resultType="io.metersphere.system.dto.OrganizationDTO">
|
||||||
select o.id, o.num, o.name, o.description, o.create_time,
|
select o.id, o.num, o.name, o.description, o.create_time,
|
||||||
o.update_time, o.create_user, o.deleted, o.delete_user, o.delete_time, o.enable,
|
o.update_time, o.create_user, o.deleted, o.delete_user, o.delete_time, o.enable,
|
||||||
count(distinct ur.user_id) as memberCount, count(distinct p.id) as projectCount
|
count(distinct u.id) as memberCount, count(distinct p.id) as projectCount
|
||||||
from organization o left join user_role_relation ur on ur.source_id = o.id
|
from organization o left join user_role_relation ur on ur.source_id = o.id
|
||||||
|
left join user u on u.id = ur.user_id and u.deleted = 0
|
||||||
left join project p on p.organization_id = o.id
|
left join project p on p.organization_id = o.id
|
||||||
<include refid="queryWhereCondition"/>
|
<include refid="queryWhereCondition"/>
|
||||||
group by o.id
|
group by o.id
|
||||||
|
@ -34,8 +35,9 @@
|
||||||
from user_role_relation urr
|
from user_role_relation urr
|
||||||
join `user` u on urr.user_id = u.id
|
join `user` u on urr.user_id = u.id
|
||||||
<where>
|
<where>
|
||||||
|
u.deleted = 0
|
||||||
<if test="request.organizationId != null">
|
<if test="request.organizationId != null">
|
||||||
urr.source_id = #{request.organizationId}
|
and urr.source_id = #{request.organizationId}
|
||||||
</if>
|
</if>
|
||||||
<if test="request.keyword != null">
|
<if test="request.keyword != null">
|
||||||
and u.name like concat('%', #{request.keyword},'%')
|
and u.name like concat('%', #{request.keyword},'%')
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<mapper namespace="io.metersphere.system.mapper.ExtUserMapper">
|
<mapper namespace="io.metersphere.system.mapper.ExtUserMapper">
|
||||||
<select id="getMemberOption" resultType="io.metersphere.system.dto.UserExtend">
|
<select id="getMemberOption" resultType="io.metersphere.system.dto.UserExtend">
|
||||||
select distinct u.*, count(urr.id) > 0 as memberFlag
|
select distinct u.*, count(urr.id) > 0 as memberFlag
|
||||||
from `user` u left join user_role_relation urr on urr.user_id = u.id and urr.source_id = #{sourceId}
|
from `user` u left join user_role_relation urr on urr.user_id = u.id and urr.source_id = #{sourceId} and u.deleted = 0
|
||||||
|
where u.deleted = 0
|
||||||
group by u.id
|
group by u.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package io.metersphere.system.service;
|
package io.metersphere.system.service;
|
||||||
|
|
||||||
import io.metersphere.sdk.constants.InternalUserRole;
|
import io.metersphere.sdk.constants.InternalUserRole;
|
||||||
|
import io.metersphere.sdk.constants.UserRoleEnum;
|
||||||
|
import io.metersphere.sdk.constants.UserRoleType;
|
||||||
import io.metersphere.sdk.dto.PermissionDefinitionItem;
|
import io.metersphere.sdk.dto.PermissionDefinitionItem;
|
||||||
import io.metersphere.sdk.dto.request.PermissionSettingUpdateRequest;
|
import io.metersphere.sdk.dto.request.PermissionSettingUpdateRequest;
|
||||||
import io.metersphere.sdk.exception.MSException;
|
import io.metersphere.sdk.exception.MSException;
|
||||||
|
@ -35,9 +37,6 @@ import static io.metersphere.system.controller.result.SystemResultCode.NO_ORG_US
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class OrganizationUserRoleService extends BaseUserRoleService {
|
public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
|
|
||||||
public static final String ORGANIZATION_ROLE_TYPE = "ORGANIZATION";
|
|
||||||
public static final String ORGANIZATION_ROLE_SCOPE = "global";
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
UserMapper userMapper;
|
UserMapper userMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -51,15 +50,15 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
|
|
||||||
public List<UserRole> list(String organizationId) {
|
public List<UserRole> list(String organizationId) {
|
||||||
UserRoleExample example = new UserRoleExample();
|
UserRoleExample example = new UserRoleExample();
|
||||||
example.createCriteria().andTypeEqualTo(ORGANIZATION_ROLE_TYPE)
|
example.createCriteria().andTypeEqualTo(UserRoleType.ORGANIZATION.name())
|
||||||
.andScopeIdIn(Arrays.asList(organizationId, ORGANIZATION_ROLE_SCOPE));
|
.andScopeIdIn(Arrays.asList(organizationId, UserRoleEnum.GLOBAL.toString()));
|
||||||
return userRoleMapper.selectByExample(example);
|
return userRoleMapper.selectByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserRole add(UserRole userRole) {
|
public UserRole add(UserRole userRole) {
|
||||||
userRole.setInternal(false);
|
userRole.setInternal(false);
|
||||||
userRole.setType(ORGANIZATION_ROLE_TYPE);
|
userRole.setType(UserRoleType.ORGANIZATION.name());
|
||||||
checkNewRoleExist(userRole);
|
checkNewRoleExist(userRole);
|
||||||
return super.add(userRole);
|
return super.add(userRole);
|
||||||
}
|
}
|
||||||
|
@ -70,7 +69,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
// 非组织用户组不允许修改, 内置用户组不允许修改
|
// 非组织用户组不允许修改, 内置用户组不允许修改
|
||||||
checkOrgUserRole(oldRole);
|
checkOrgUserRole(oldRole);
|
||||||
checkInternalUserRole(oldRole);
|
checkInternalUserRole(oldRole);
|
||||||
userRole.setType(ORGANIZATION_ROLE_TYPE);
|
userRole.setType(UserRoleType.ORGANIZATION.name());
|
||||||
checkNewRoleExist(userRole);
|
checkNewRoleExist(userRole);
|
||||||
return super.update(userRole);
|
return super.update(userRole);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +174,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
* @param userRole 用户组
|
* @param userRole 用户组
|
||||||
*/
|
*/
|
||||||
private void checkOrgUserRole(UserRole userRole) {
|
private void checkOrgUserRole(UserRole userRole) {
|
||||||
if (!ORGANIZATION_ROLE_TYPE.equals(userRole.getType())) {
|
if (!UserRoleType.ORGANIZATION.name().equals(userRole.getType())) {
|
||||||
throw new MSException(NO_ORG_USER_ROLE_PERMISSION);
|
throw new MSException(NO_ORG_USER_ROLE_PERMISSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +186,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||||
private void checkNewRoleExist(UserRole userRole) {
|
private void checkNewRoleExist(UserRole userRole) {
|
||||||
UserRoleExample example = new UserRoleExample();
|
UserRoleExample example = new UserRoleExample();
|
||||||
UserRoleExample.Criteria criteria = example.createCriteria().andNameEqualTo(userRole.getName())
|
UserRoleExample.Criteria criteria = example.createCriteria().andNameEqualTo(userRole.getName())
|
||||||
.andScopeIdIn(Arrays.asList(userRole.getScopeId(), ORGANIZATION_ROLE_SCOPE))
|
.andScopeIdIn(Arrays.asList(userRole.getScopeId(), UserRoleEnum.GLOBAL.toString()))
|
||||||
.andTypeEqualTo(userRole.getType());
|
.andTypeEqualTo(userRole.getType());
|
||||||
if (userRole.getId() != null) {
|
if (userRole.getId() != null) {
|
||||||
criteria.andIdNotEqualTo(userRole.getId());
|
criteria.andIdNotEqualTo(userRole.getId());
|
||||||
|
|
Loading…
Reference in New Issue