fix(系统设置): 组织列表移除用户不展示
This commit is contained in:
parent
5eed64f4ba
commit
c5982c8424
|
@ -98,7 +98,15 @@ public class PermissionConstants {
|
|||
|
||||
/*------ 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_UPDATE = "SYSTEM_QUOTA:READ+UPDATE";
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
<select id="list" resultType="io.metersphere.system.dto.OrganizationDTO">
|
||||
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,
|
||||
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
|
||||
left join user u on u.id = ur.user_id and u.deleted = 0
|
||||
left join project p on p.organization_id = o.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
group by o.id
|
||||
|
@ -34,8 +35,9 @@
|
|||
from user_role_relation urr
|
||||
join `user` u on urr.user_id = u.id
|
||||
<where>
|
||||
u.deleted = 0
|
||||
<if test="request.organizationId != null">
|
||||
urr.source_id = #{request.organizationId}
|
||||
and urr.source_id = #{request.organizationId}
|
||||
</if>
|
||||
<if test="request.keyword != null">
|
||||
and u.name like concat('%', #{request.keyword},'%')
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<mapper namespace="io.metersphere.system.mapper.ExtUserMapper">
|
||||
<select id="getMemberOption" resultType="io.metersphere.system.dto.UserExtend">
|
||||
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
|
||||
</select>
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package io.metersphere.system.service;
|
||||
|
||||
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.request.PermissionSettingUpdateRequest;
|
||||
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)
|
||||
public class OrganizationUserRoleService extends BaseUserRoleService {
|
||||
|
||||
public static final String ORGANIZATION_ROLE_TYPE = "ORGANIZATION";
|
||||
public static final String ORGANIZATION_ROLE_SCOPE = "global";
|
||||
|
||||
@Resource
|
||||
UserMapper userMapper;
|
||||
@Resource
|
||||
|
@ -51,15 +50,15 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
|||
|
||||
public List<UserRole> list(String organizationId) {
|
||||
UserRoleExample example = new UserRoleExample();
|
||||
example.createCriteria().andTypeEqualTo(ORGANIZATION_ROLE_TYPE)
|
||||
.andScopeIdIn(Arrays.asList(organizationId, ORGANIZATION_ROLE_SCOPE));
|
||||
example.createCriteria().andTypeEqualTo(UserRoleType.ORGANIZATION.name())
|
||||
.andScopeIdIn(Arrays.asList(organizationId, UserRoleEnum.GLOBAL.toString()));
|
||||
return userRoleMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserRole add(UserRole userRole) {
|
||||
userRole.setInternal(false);
|
||||
userRole.setType(ORGANIZATION_ROLE_TYPE);
|
||||
userRole.setType(UserRoleType.ORGANIZATION.name());
|
||||
checkNewRoleExist(userRole);
|
||||
return super.add(userRole);
|
||||
}
|
||||
|
@ -70,7 +69,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
|||
// 非组织用户组不允许修改, 内置用户组不允许修改
|
||||
checkOrgUserRole(oldRole);
|
||||
checkInternalUserRole(oldRole);
|
||||
userRole.setType(ORGANIZATION_ROLE_TYPE);
|
||||
userRole.setType(UserRoleType.ORGANIZATION.name());
|
||||
checkNewRoleExist(userRole);
|
||||
return super.update(userRole);
|
||||
}
|
||||
|
@ -175,7 +174,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
|||
* @param 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);
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +186,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
|||
private void checkNewRoleExist(UserRole userRole) {
|
||||
UserRoleExample example = new UserRoleExample();
|
||||
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());
|
||||
if (userRole.getId() != null) {
|
||||
criteria.andIdNotEqualTo(userRole.getId());
|
||||
|
|
Loading…
Reference in New Issue