fix(系统管理): 用户组相关功能BUG修复

--bug=1037240 --user=宋昌昌 【项目管理】项目与权限-用户组-管理员账号来修改权限,报错没有权限操作全局用户组 https://www.tapd.cn/55049933/s/1476736
This commit is contained in:
song-cc-rock 2024-03-17 01:41:15 +08:00 committed by Craftsman
parent ab88a007d3
commit b99d7a60fa
9 changed files with 28 additions and 19 deletions

View File

@ -10,7 +10,7 @@
ur.name like concat('%', #{request.keyword}, '%')
)
</if>
order by ur.create_time
order by ur.internal desc, ur.scope_id desc, ur.create_time
</select>
<select id="getRelationByRoleIds" resultType="io.metersphere.system.domain.UserRoleRelation">

View File

@ -28,7 +28,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -74,7 +73,6 @@ public class ProjectUserRoleService extends BaseUserRoleService {
role.setMemberCount(0);
});
}
roles.sort(Comparator.comparing(UserRole::getInternal).reversed());
return roles;
}

View File

@ -47,7 +47,8 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
.andScopeIdIn(Arrays.asList(organizationId, UserRoleEnum.GLOBAL.toString()));
example.setOrderByClause("create_time asc");
List<UserRole> userRoles = userRoleMapper.selectByExample(example);
userRoles.sort(Comparator.comparing(UserRole::getInternal).reversed());
userRoles.sort(Comparator.comparing(UserRole::getInternal)
.thenComparing(UserRole::getScopeId).thenComparing(Comparator.comparing(UserRole::getCreateTime).reversed()).reversed());
return userRoles;
}

View File

@ -20,7 +20,7 @@
v-if="tableData && tableData?.length > 0"
:model-value="allChecked"
:indeterminate="allIndeterminate"
:disabled="systemAdminDisabled"
:disabled="systemAdminDisabled || disabled"
class="mr-[7px]"
@change="handleAllAuthChangeByCheckbox"
></a-checkbox>
@ -35,7 +35,7 @@
<a-checkbox
v-for="item in record.permissions"
:key="item.id"
:disabled="item.license || systemAdminDisabled"
:disabled="item.license || systemAdminDisabled || disabled"
:value="item.id"
>{{ t(item.name) }}</a-checkbox
>
@ -44,7 +44,7 @@
class="mr-[7px]"
:model-value="record.enable"
:indeterminate="record.indeterminate"
:disabled="systemAdminDisabled"
:disabled="systemAdminDisabled || disabled"
@change="(value) => handleRowAuthChange(value, rowIndex)"
/>
</div>

View File

@ -69,7 +69,10 @@
>{{ element.name }}</div
>
</a-tooltip>
<div v-if="element.id === currentId && !element.internal" class="flex flex-row items-center gap-[8px]">
<div
v-if="element.id === currentId && element.scopeId !== 'global'"
class="flex flex-row items-center gap-[8px]"
>
<MsMoreAction
v-if="element.type === systemType"
v-permission="props.updatePermission"
@ -157,7 +160,10 @@
>{{ element.name }}</div
>
</a-tooltip>
<div v-if="element.id === currentId && !element.internal" class="flex flex-row items-center gap-[8px]">
<div
v-if="element.id === currentId && element.scopeId !== 'global'"
class="flex flex-row items-center gap-[8px]"
>
<MsMoreAction
v-if="element.type === systemType"
v-permission="props.updatePermission"
@ -245,7 +251,10 @@
>{{ element.name }}</div
>
</a-tooltip>
<div v-if="element.id === currentId && !element.internal" class="flex flex-row items-center gap-[8px]">
<div
v-if="element.id === currentId && element.scopeId !== 'global'"
class="flex flex-row items-center gap-[8px]"
>
<MsMoreAction
v-if="element.type === systemType"
v-permission="props.updatePermission"

View File

@ -162,7 +162,7 @@
item.editType &&
editActiveKey !== `${item.dataIndex}${rowIndex}` &&
!record.deleted &&
!record.internal
record.scopeId !== 'global'
"
class="ml-2 cursor-pointer"
:class="{ 'ms-table-edit-active': editActiveKey === rowIndex }"
@ -264,7 +264,6 @@
import { useI18n } from '@/hooks/useI18n';
import { useAppStore, useTableStore } from '@/store';
import { characterLimit } from '@/utils';
import { DragSortParams } from '@/models/common';
import { ColumnEditTypeEnum, SelectAllEnum, SpecialColumnEnum } from '@/enums/tableEnum';

View File

@ -61,7 +61,7 @@ export default {
'common.leave': '离开',
'common.rename': '重命名',
'common.noData': '暂无数据',
'common.internal': '内部',
'common.internal': '系统内置',
'common.custom': '自定义',
'common.preview': '预览',
'common.fullScreen': '全屏',

View File

@ -17,7 +17,7 @@
<div class="flex flex-row items-center gap-[4px]">
<div class="one-line-text">{{ record.name }}</div>
<div class="ml-1 text-[var(--color-text-4)]">{{
`(${record.internal ? t('common.internal') : t('common.custom')})`
`(${record.scopeId === 'global' ? t('common.internal') : t('common.custom')})`
}}</div>
</div>
</template>
@ -34,10 +34,10 @@
<div class="flex flex-row flex-nowrap">
<span v-permission="['PROJECT_GROUP:READ']" class="flex flex-row">
<MsButton class="!mr-0" @click="showAuthDrawer(record)">{{ t('project.userGroup.viewAuth') }}</MsButton>
<a-divider v-if="!record.internal" direction="vertical" />
<a-divider v-if="record.scopeId !== 'global'" direction="vertical" />
</span>
<MsButton
v-if="!record.internal"
v-if="record.scopeId !== 'global'"
v-permission="['PROJECT_GROUP:READ+UPDATE']"
class="!mr-0"
status="danger"
@ -51,7 +51,7 @@
:width="928"
:visible="authVisible"
unmount-on-close
:footer="!currentItem.internal"
:footer="currentItem.scopeId !== 'global'"
:title="currentItem.name"
:mask="false"
@cancel="authVisible = false"
@ -61,7 +61,7 @@
:show-bottom="false"
:scroll="{ x: 800, y: 'calc(100vh - 150px)' }"
:current="currentItem"
:disabled="!hasAnyPermission(['PROJECT_GROUP:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_GROUP:READ+UPDATE']) || currentItem.scopeId === 'global'"
/>
<template #footer>
<div class="flex items-center justify-between">

View File

@ -51,7 +51,9 @@
:current="currentUserGroupItem"
:width="bottomWidth"
:save-permission="['ORGANIZATION_USER_ROLE:READ+UPDATE']"
:disabled="!hasAnyPermission(['ORGANIZATION_USER_ROLE:READ+UPDATE'])"
:disabled="
!hasAnyPermission(['ORGANIZATION_USER_ROLE:READ+UPDATE']) || currentUserGroupItem.scopeId === 'global'
"
/>
</div>
</div>