fix: 权限相关严重bug修改
This commit is contained in:
parent
7ab54e66ac
commit
15ff97a4cb
|
@ -7,14 +7,12 @@
|
|||
</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<paramsTable
|
||||
v-model:params="innerParams.responseHeader"
|
||||
:selectable="false"
|
||||
:columns="columns"
|
||||
:scroll="{ minWidth: '700px' }"
|
||||
:default-param-item="defaultParamItem"
|
||||
@change="handleParamTableChange"
|
||||
/>
|
||||
<div v-if="innerParams.type === 'jsonPath'">
|
||||
<MsJsonPathPicker data="" />
|
||||
</div>
|
||||
<div v-else-if="innerParams.type === 'xPath'">
|
||||
<MsXPathPicker :xml-string="innerParams.response" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -22,6 +20,8 @@
|
|||
import { defineModel } from 'vue';
|
||||
|
||||
import { statusCodeOptions } from '@/components/pure/ms-advance-filter/index';
|
||||
import MsJsonPathPicker from '@/components/pure/ms-jsonpath-picker/index.vue';
|
||||
import MsXPathPicker from '@/components/pure/ms-jsonpath-picker/xpath.vue';
|
||||
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
|
||||
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
@ -37,28 +37,6 @@
|
|||
}>();
|
||||
const { t } = useI18n();
|
||||
|
||||
const defaultParamItem = {
|
||||
responseHeader: '',
|
||||
matchCondition: '',
|
||||
matchValue: '',
|
||||
enable: true,
|
||||
};
|
||||
|
||||
const responseHeaderOption = [
|
||||
{ label: 'Accept', value: 'accept' },
|
||||
{ label: 'Accept-Encoding', value: 'acceptEncoding' },
|
||||
{ label: 'Accept-Language', value: 'acceptLanguage' },
|
||||
{ label: 'Cache-Control', value: 'cacheControl' },
|
||||
{ label: 'Content-Type', value: 'contentType' },
|
||||
{ label: 'Content-Length', value: 'contentLength' },
|
||||
{ label: 'User-Agent', value: 'userAgent' },
|
||||
{ label: 'Referer', value: 'referer' },
|
||||
{ label: 'Cookie', value: 'cookie' },
|
||||
{ label: 'Authorization', value: 'authorization' },
|
||||
{ label: 'If-None-Match', value: 'ifNoneMatch' },
|
||||
{ label: 'If-Modified-Since', value: 'ifModifiedSince' },
|
||||
];
|
||||
|
||||
const responseRadios = [
|
||||
{ label: 'ms.assertion.jsonPath', value: 'jsonPath' },
|
||||
{ label: 'ms.assertion.xpath', value: 'xPath' },
|
||||
|
@ -66,44 +44,4 @@
|
|||
{ label: 'ms.assertion.regular', value: 'regular' },
|
||||
{ label: 'ms.assertion.script', value: 'script' },
|
||||
];
|
||||
|
||||
const columns: ParamTableColumn[] = [
|
||||
{
|
||||
title: 'ms.assertion.responseHeader', // 响应头
|
||||
dataIndex: 'responseHeader',
|
||||
slotName: 'responseHeader',
|
||||
showInTable: true,
|
||||
showDrag: true,
|
||||
options: responseHeaderOption,
|
||||
},
|
||||
{
|
||||
title: 'ms.assertion.matchCondition', // 匹配条件
|
||||
dataIndex: 'matchCondition',
|
||||
slotName: 'matchCondition',
|
||||
showInTable: true,
|
||||
showDrag: true,
|
||||
options: statusCodeOptions,
|
||||
},
|
||||
{
|
||||
title: 'ms.assertion.matchValue', // 匹配值
|
||||
dataIndex: 'matchValue',
|
||||
slotName: 'matchValue',
|
||||
showInTable: true,
|
||||
showDrag: true,
|
||||
},
|
||||
{
|
||||
title: '',
|
||||
columnTitle: 'common.operation',
|
||||
slotName: 'operation',
|
||||
width: 50,
|
||||
showInTable: true,
|
||||
showDrag: true,
|
||||
},
|
||||
];
|
||||
function handleParamTableChange(resultArr: any[], isInit?: boolean) {
|
||||
innerParams.value = [...resultArr];
|
||||
if (!isInit) {
|
||||
emit('change');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
class="hidden-item"
|
||||
>
|
||||
<a-input
|
||||
v-if="item.type === FilterType.INPUT"
|
||||
v-if="item.type === FilterType.INPUT && !isMutipleOperator(item.operator as string)"
|
||||
v-model:model-value="item.value"
|
||||
class="w-full"
|
||||
allow-clear
|
||||
|
@ -84,7 +84,7 @@
|
|||
:max-length="255"
|
||||
/>
|
||||
<MsTagsInput
|
||||
v-else-if="item.type === FilterType.TAGS_INPUT"
|
||||
v-else-if="isMutipleOperator(item.operator as string)"
|
||||
v-model:model-value="item.value"
|
||||
:disabled="!item.dataIndex"
|
||||
allow-clear
|
||||
|
@ -214,7 +214,7 @@
|
|||
|
||||
import { SelectValue } from '@/models/projectManagement/menuManagement';
|
||||
|
||||
import { OPERATOR_MAP } from './index';
|
||||
import { isMutipleOperator, OPERATOR_MAP } from './index';
|
||||
import { AccordBelowType, BackEndEnum, CombineItem, FilterFormItem, FilterResult, FilterType } from './type';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -334,7 +334,7 @@
|
|||
combine[item.dataIndex as string] = {
|
||||
operator: item.operator,
|
||||
value: item.value,
|
||||
backendType: item.backendType,
|
||||
backendType: Array.isArray(item.value) ? BackEndEnum.ARRAY : item.backendType,
|
||||
};
|
||||
});
|
||||
tmpObj.accordBelow = accordBelow.value;
|
||||
|
@ -366,7 +366,7 @@
|
|||
};
|
||||
|
||||
const operationChange = (v: SelectValue, dataIndex: string, idx: number) => {
|
||||
if (v === 'between') {
|
||||
if (isMutipleOperator(v as string)) {
|
||||
formModel.list[idx].value = [];
|
||||
} else {
|
||||
formModel.list[idx].value = isMultipleSelect(dataIndex) ? [] : '';
|
||||
|
|
|
@ -132,3 +132,9 @@ export const CustomTypeMaps: Record<string, any> = {
|
|||
type: 'TAGS_INPUT',
|
||||
},
|
||||
};
|
||||
|
||||
export const MULTIPLE_OPERATOR_LIST = ['in', 'not_in', 'between'];
|
||||
|
||||
export function isMutipleOperator(operator: string) {
|
||||
return MULTIPLE_OPERATOR_LIST.includes(operator);
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@
|
|||
id: item.field as string,
|
||||
name: item.title as string,
|
||||
type: item.sourceType as string,
|
||||
value: item.value as string,
|
||||
value: Array.isArray(item.value) ? JSON.stringify(item.value) : (item.value as string),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@
|
|||
id: item.field as string,
|
||||
name: item.title as string,
|
||||
type: item.sourceType as string,
|
||||
value: item.value as string,
|
||||
value: Array.isArray(item.value) ? JSON.stringify(item.value) : (item.value as string),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
},
|
||||
{
|
||||
title: 'bugManagement.creator',
|
||||
dataIndex: 'createUser',
|
||||
dataIndex: 'createUserName',
|
||||
width: 112,
|
||||
showTooltip: true,
|
||||
showDrag: true,
|
||||
|
|
|
@ -22,13 +22,17 @@
|
|||
</div>
|
||||
</template>
|
||||
<template #memberCount="{ record }">
|
||||
<span class="cursor-pointer text-[rgb(var(--primary-5))]" @click="showUserDrawer(record)">{{
|
||||
record.memberCount
|
||||
}}</span>
|
||||
<span
|
||||
v-if="hasAnyPermission(['PROJECT_GROUP:READ+UPDATE'])"
|
||||
class="cursor-pointer text-[rgb(var(--primary-5))]"
|
||||
@click="showUserDrawer(record)"
|
||||
>{{ record.memberCount }}</span
|
||||
>
|
||||
<span v-else>{{ record.memberCount }}</span>
|
||||
</template>
|
||||
<template #operation="{ record }">
|
||||
<div class="flex flex-row flex-nowrap">
|
||||
<span v-permission="['PROJECT_GROUP:READ+UPDATE']" class="flex flex-row">
|
||||
<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" />
|
||||
</span>
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
>
|
||||
<div>
|
||||
<div class="flex flex-row justify-between">
|
||||
<a-button type="primary" @click="handleAddMember">
|
||||
<a-button
|
||||
v-if="hasAnyPermission(['ORGANIZATION_PROJECT:READ+ADD+MEMBER'])"
|
||||
type="primary"
|
||||
@click="handleAddMember"
|
||||
>
|
||||
{{ t('system.organization.addMember') }}
|
||||
</a-button>
|
||||
<a-input-search
|
||||
|
@ -32,6 +36,7 @@
|
|||
</template>
|
||||
<template #operation="{ record }">
|
||||
<MsRemoveButton
|
||||
v-permission="['ORGANIZATION_PROJECT:READ+DELETE+MEMBER']"
|
||||
:title="t('system.project.removeName', { name: record.name })"
|
||||
:sub-title-tip="t('system.project.removeTip')"
|
||||
@ok="handleRemove(record)"
|
||||
|
@ -62,6 +67,7 @@
|
|||
import { deleteProjectMemberByOrg, postProjectMemberByProjectId } from '@/api/modules/setting/organizationAndProject';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { formatPhoneNumber } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
export interface projectDrawerProps {
|
||||
visible: boolean;
|
||||
|
@ -81,6 +87,8 @@
|
|||
|
||||
const keyword = ref('');
|
||||
|
||||
const hasOperationPermission = computed(() => hasAnyPermission(['ORGANIZATION_PROJECT:READ+DELETE+MEMBER']));
|
||||
|
||||
const projectColumn: MsTableColumn = [
|
||||
{
|
||||
title: 'system.organization.userName',
|
||||
|
@ -100,9 +108,9 @@
|
|||
dataIndex: 'phone',
|
||||
},
|
||||
{
|
||||
title: 'system.organization.operation',
|
||||
title: hasOperationPermission.value ? 'system.organization.operation' : '',
|
||||
slotName: 'operation',
|
||||
width: 60,
|
||||
width: hasOperationPermission.value ? 60 : 20,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</template>
|
||||
<template #memberCount="{ record }">
|
||||
<span
|
||||
v-if="hasAnyPermission(['ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||
v-if="hasAnyPermission(['ORGANIZATION_PROJECT:READ+ADD+MEMBER'])"
|
||||
class="cursor-pointer text-[rgb(var(--primary-5))]"
|
||||
@click="showUserDrawer(record)"
|
||||
>{{ record.memberCount }}</span
|
||||
|
@ -61,7 +61,7 @@
|
|||
<MsButton v-permission="['ORGANIZATION_PROJECT:READ+UPDATE']" @click="showAddProjectModal(record)">{{
|
||||
t('common.edit')
|
||||
}}</MsButton>
|
||||
<MsButton v-permission="['ORGANIZATION_PROJECT:READ+UPDATE']" @click="showAddUserModal(record)">{{
|
||||
<MsButton v-permission="['ORGANIZATION_PROJECT:READ+ADD+MEMBER']" @click="showAddUserModal(record)">{{
|
||||
t('system.organization.addMember')
|
||||
}}</MsButton>
|
||||
<MsButton
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</template>
|
||||
<template #memberCount="{ record }">
|
||||
<span
|
||||
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER'])"
|
||||
class="primary-color"
|
||||
@click="showUserDrawer(record)"
|
||||
>{{ record.memberCount }}</span
|
||||
|
@ -46,27 +46,29 @@
|
|||
}}</MsButton>
|
||||
</template>
|
||||
<template v-else-if="!record.enable">
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="handleEnableOrDisableOrg(record)">{{
|
||||
t('common.enable')
|
||||
}}</MsButton>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{
|
||||
<MsButton
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']"
|
||||
@click="handleEnableOrDisableOrg(record)"
|
||||
>{{ t('common.enable') }}</MsButton
|
||||
>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{
|
||||
t('common.delete')
|
||||
}}</MsButton>
|
||||
</template>
|
||||
<template v-else>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="showOrganizationModal(record)">{{
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']" @click="showOrganizationModal(record)">{{
|
||||
t('common.edit')
|
||||
}}</MsButton>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="showAddUserModal(record)">{{
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER']" @click="showAddUserModal(record)">{{
|
||||
t('system.organization.addMember')
|
||||
}}</MsButton>
|
||||
<MsButton
|
||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']"
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']"
|
||||
@click="handleEnableOrDisableOrg(record, false)"
|
||||
>{{ t('common.end') }}</MsButton
|
||||
>
|
||||
<MsTableMoreAction
|
||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']"
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']"
|
||||
:list="tableActions"
|
||||
@select="handleMoreAction($event, record)"
|
||||
></MsTableMoreAction>
|
||||
|
@ -154,7 +156,7 @@
|
|||
dataIndex: 'name',
|
||||
width: 300,
|
||||
revokeDeletedSlot: 'revokeDelete',
|
||||
editType: hasAnyPermission(['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']) ? ColumnEditTypeEnum.INPUT : undefined,
|
||||
editType: hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']) ? ColumnEditTypeEnum.INPUT : undefined,
|
||||
showTooltip: true,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</template>
|
||||
<template #memberCount="{ record }">
|
||||
<span
|
||||
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER'])"
|
||||
class="primary-color"
|
||||
@click="showUserDrawer(record)"
|
||||
>{{ record.memberCount }}</span
|
||||
|
@ -38,28 +38,28 @@
|
|||
</template>
|
||||
<template v-else-if="!record.enable">
|
||||
<MsButton
|
||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']"
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']"
|
||||
@click="handleEnableOrDisableProject(record)"
|
||||
>{{ t('common.enable') }}</MsButton
|
||||
>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{
|
||||
t('common.delete')
|
||||
}}</MsButton>
|
||||
</template>
|
||||
<template v-else>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="showAddProjectModal(record)">{{
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']" @click="showAddProjectModal(record)">{{
|
||||
t('common.edit')
|
||||
}}</MsButton>
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ']" @click="showAddUserModal(record)">{{
|
||||
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER']" @click="showAddUserModal(record)">{{
|
||||
t('system.organization.addMember')
|
||||
}}</MsButton>
|
||||
<MsButton
|
||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']"
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']"
|
||||
@click="handleEnableOrDisableProject(record, false)"
|
||||
>{{ t('common.end') }}</MsButton
|
||||
>
|
||||
<MsTableMoreAction
|
||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']"
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']"
|
||||
:list="tableActions"
|
||||
@select="handleMoreAction($event, record)"
|
||||
></MsTableMoreAction>
|
||||
|
@ -144,7 +144,7 @@
|
|||
title: 'system.organization.name',
|
||||
dataIndex: 'name',
|
||||
revokeDeletedSlot: 'revokeDelete',
|
||||
editType: hasAnyPermission(['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']) ? ColumnEditTypeEnum.INPUT : undefined,
|
||||
editType: hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']) ? ColumnEditTypeEnum.INPUT : undefined,
|
||||
showTooltip: true,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -11,7 +11,11 @@
|
|||
>
|
||||
<div>
|
||||
<div class="flex flex-row justify-between">
|
||||
<a-button v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" type="primary" @click="handleAddMember">
|
||||
<a-button
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER']"
|
||||
type="primary"
|
||||
@click="handleAddMember"
|
||||
>
|
||||
{{ t('system.organization.addMember') }}
|
||||
</a-button>
|
||||
<a-input-search
|
||||
|
@ -33,7 +37,7 @@
|
|||
</template>
|
||||
<template #operation="{ record }">
|
||||
<MsRemoveButton
|
||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']"
|
||||
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE_MEMBER']"
|
||||
:title="t('system.organization.removeName', { name: characterLimit(record.name) })"
|
||||
:sub-title-tip="props.organizationId ? t('system.organization.removeTip') : t('system.project.removeTip')"
|
||||
@ok="handleRemove(record)"
|
||||
|
|
Loading…
Reference in New Issue