diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java index 3f2993b8fd..99d54b2930 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/constants/PermissionConstants.java @@ -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"; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml index 61c3f8477f..eca4677ad5 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtOrganizationMapper.xml @@ -4,8 +4,9 @@ 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 diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationUserRoleService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationUserRoleService.java index e844ca7853..6f590ee542 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationUserRoleService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/OrganizationUserRoleService.java @@ -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 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());