Skip to content

Commit

Permalink
Merge pull request #2402 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
v1.10.18
  • Loading branch information
zhu327 authored Nov 30, 2023
2 parents 9d50a81 + 2434627 commit 68b9c5a
Show file tree
Hide file tree
Showing 35 changed files with 648 additions and 260 deletions.
31 changes: 23 additions & 8 deletions frontend/src/components/dialog-infinite-list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<script>
import _ from 'lodash';
import { mapGetters } from 'vuex';
import { getParamsValue } from '@/common/util';
export default {
name: 'dialog-infinite-list',
Expand Down Expand Up @@ -114,7 +115,8 @@
currentFocusIndex: this.focusIndex,
organizationIndex: -1,
userIndex: -1,
enableOrganizationCount: window.ENABLE_ORGANIZATION_COUNT.toLowerCase() === 'true'
enableOrganizationCount: window.ENABLE_ORGANIZATION_COUNT.toLowerCase() === 'true',
noVerifyRoutes: ['authorBoundaryEditFirstLevel', 'authorBoundaryEditSecondLevel', 'applyJoinUserGroup', 'addMemberBoundary', 'gradingAdminCreate', 'gradingAdminEdit']
};
},
computed: {
Expand Down Expand Up @@ -279,12 +281,20 @@
node.is_selected = !node.is_selected;
this.$emit('on-checked', node.is_selected, !node.is_selected, node.is_selected, node);
} else {
const result = await this.fetchSubjectScopeCheck(node);
if (result) {
if (
(getParamsValue('search_scene') && getParamsValue('search_scene') === 'add')
|| this.noVerifyRoutes.includes(this.$route.name)
) {
node.is_selected = !node.is_selected;
this.$emit('on-checked', node.is_selected, !node.is_selected, node.is_selected, node);
} else {
this.messageWarn(this.$t(`m.verify['当前选择项不在授权范围内']`), 3000);
const result = await this.fetchSubjectScopeCheck(node);
if (result) {
node.is_selected = !node.is_selected;
this.$emit('on-checked', node.is_selected, !node.is_selected, node.is_selected, node);
} else {
this.messageWarn(this.$t(`m.verify['当前选择项不在授权范围内']`), 3000);
}
}
}
}
Expand All @@ -297,12 +307,17 @@
node.is_selected = !node.is_selected;
this.$emit('on-checked', node.is_selected, !node.is_selected, true, node);
} else {
const result = await this.fetchSubjectScopeCheck(node);
if (result) {
if (getParamsValue('search_scene') && getParamsValue('search_scene') === 'add') {
node.is_selected = !node.is_selected;
this.$emit('on-checked', node.is_selected, !node.is_selected, true, node);
this.$emit('on-checked', node.is_selected, !node.is_selected, node.is_selected, node);
} else {
this.messageWarn(this.$t(`m.verify['当前选择项不在授权范围内']`), 3000);
const result = await this.fetchSubjectScopeCheck(node);
if (result) {
node.is_selected = !node.is_selected;
this.$emit('on-checked', node.is_selected, !node.is_selected, node.is_selected, node);
} else {
this.messageWarn(this.$t(`m.verify['当前选择项不在授权范围内']`), 3000);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/header/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ $cubic-bezier: cubic-bezier(0.4, 0, 0.2, 1);
&.has-cursor {
cursor: pointer;
}
.breadcrumbs-content {
display: flex;
align-items: center;
}
.breadcrumbs-back {
position: relative;
left: -5px;
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
:class="backRouter ? 'has-cursor' : ''"
v-show="isShowExternal || (!mainContentLoading && !externalSystemsLayout.hideIamBreadCrumbs)"
@click="back">
<div v-if="!isHide">
<div v-if="!isHide" class="breadcrumbs-content">
<Icon type="arrows-left" class="breadcrumbs-back" v-if="backRouter" />
<h2 v-if="customBreadCrumbTitles.includes(routeName)" class="breadcrumbs-current">
<h2 v-if="customBreadCrumbTitles.includes(routeName)" class="breadcrumbs-current single-hide">
{{ $t(`m.info['用户组成员添加权限']`, { value: `${$t(`m.common['【']`)}${userGroupName}${$t(`m.common['】']`)}` }) }}
</h2>
<h2 v-else class="breadcrumbs-current">{{ headerTitle }}</h2>
<h2 v-else class="breadcrumbs-current single-hide">{{ headerTitle }}</h2>
</div>
</div>
<!-- <div class="user fr">
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ export const m = {
'创建时间': 'Created at',
'更新人': 'Modified by',
'更新时间': 'Modified at',
"进入空间": "Go To",
"进入空间": "Go to",
"克隆": "Clone",
'请输入空间名': 'Please enter the space name',
'管理员': 'Administrators',
Expand Down Expand Up @@ -1118,6 +1118,7 @@ export const m = {
'授权类API白名单删除': 'Author class API whitelist delete',
'管理类API白名单创建': 'Management class API whitelist create',
'管理类API白名单删除': 'Management class API whitelist delete',
'操作敏感等级更新': 'Action sensitivity level update',
'回滚事件': 'Rollback event',
'管理空间用户组成员续期': 'Management space group members renew',
'用户组成员续期': 'Group members renew',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/language/lang/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ export const m = {
'授权类API白名单删除': '授权类API白名单删除',
'管理类API白名单创建': '管理类API白名单创建',
'管理类API白名单删除': '管理类API白名单删除',
'操作敏感等级更新': '操作敏感等级更新',
'回滚事件': '回滚事件',
'管理空间用户组成员续期': '管理空间用户组成员续期',
'用户组成员续期': '用户组成员续期',
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/views/audit/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
// 只有子对象的审计类型
const ONLY_SUB_TYPE = [
'action.sensitivity.level.update',
'group.template.create',
'group.member.create',
'group.member.delete',
Expand Down Expand Up @@ -319,7 +320,8 @@
super_manager: this.$t(`m.myApproval['超级管理员']`),
system_manager: this.$t(`m.nav['系统管理员']`),
rating_manager: this.$t(`m.nav['一级空间管理员']`),
subset_manager: this.$t(`m.nav['二级空间管理员']`)
subset_manager: this.$t(`m.nav['二级空间管理员']`),
action: this.$t(`m.common['操作-table']`)
},
sourceMap: {
web: this.$t(`m.audit['页面']`),
Expand Down Expand Up @@ -382,7 +384,8 @@
'authorization.api.allow.list.config.delete': this.$t(`m.audit['授权类API白名单删除']`),
'management.api.allow.list.config.create': this.$t(`m.audit['管理类API白名单创建']`),
'management.api.allow.list.config.delete': this.$t(`m.audit['管理类API白名单删除']`),
'group.transfer': this.$t(`m.audit['用户组权限交接']`)
'group.transfer': this.$t(`m.audit['用户组权限交接']`),
'action.sensitivity.level.update': this.$t(`m.audit['操作敏感等级更新']`)
},
currentMonth: '',
noDetailType: NO_DETAIL_TYPE,
Expand Down Expand Up @@ -680,7 +683,8 @@
{ id: 'authorization.api.allow.list.config.create', name: this.$t(`m.audit['授权类API白名单创建']`) },
{ id: 'authorization.api.allow.list.config.delete', name: this.$t(`m.audit['授权类API白名单删除']`) },
{ id: 'management.api.allow.list.config.create', name: this.$t(`m.audit['管理类API白名单创建']`) },
{ id: 'management.api.allow.list.config.delete', name: this.$t(`m.audit['管理类API白名单删除']`) }
{ id: 'management.api.allow.list.config.delete', name: this.$t(`m.audit['管理类API白名单删除']`) },
{ id: 'action.sensitivity.level.update', name: this.$t(`m.audit['操作敏感等级更新']`) }
];
if (value === '') {
return Promise.resolve(list);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@
item.sub_groups = [];
}
let allChecked = true;
item.actions = item.actions.filter(v => !v.hidden);
// item.actions = item.actions.filter(v => !v.hidden);
item.actions.forEach(act => {
act.$id = `${payload}&${act.id}`;
act.related_resource_types.forEach(v => {
Expand All @@ -649,7 +649,7 @@
this.linearAction.push(act);
});
item.sub_groups.forEach(act => {
act.actions = act.actions.filter(v => !v.hidden);
// act.actions = act.actions.filter(v => !v.hidden);
(act.actions || []).forEach(v => {
v.$id = `${payload}&${v.id}`;
v.related_resource_types.forEach(subItem => {
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/views/group/clone/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,7 @@
await this.getGroupCustomPolicy(this.groupSystemList[i]);
}
if (this.groupSystemList[i].template_count > 0) {
setTimeout(async () => {
await this.getGroupTemplateList(this.groupSystemList[i]);
}, 500);
await this.getGroupTemplateList(this.groupSystemList[i]);
}
}
this.handleAggregateData();
Expand Down Expand Up @@ -776,7 +774,7 @@
addCustomList.forEach(item => {
if (!item.resource_groups || !item.resource_groups.length) {
item.resource_groups = item.related_resource_types.length ? [{ id: '', related_resource_types: item.related_resource_types }] : [];
item.resource_groups = item.related_resource_types && item.related_resource_types.length ? [{ id: '', related_resource_types: item.related_resource_types }] : [];
}
tempList.push(new GroupPolicy(item, 'add', 'custom', {
system: {
Expand Down
67 changes: 35 additions & 32 deletions frontend/src/views/group/components/iam-add-member.vue
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@
manualTableList: [],
manualTableListStorage: [],
hasSelectedManualDepartments: [],
hasSelectedManualUsers: []
hasSelectedManualUsers: [],
noVerifyRoutes: ['authorBoundaryEditFirstLevel', 'authorBoundaryEditSecondLevel', 'applyJoinUserGroup', 'addMemberBoundary', 'gradingAdminCreate', 'gradingAdminEdit']
};
},
computed: {
Expand Down Expand Up @@ -1088,39 +1089,41 @@
// 校验部门/用户范围是否满足条件
async fetchSubjectScopeCheck (payload, mode) {
const subjects = payload.map((item) => {
const { id, type, username } = item;
const typeMap = {
depart: () => {
return {
type: 'department',
id
};
},
user: () => {
return {
type: 'user',
id: username
};
}
};
return typeMap[type || mode]();
});
try {
const { code, data } = await this.$store.dispatch('organization/getSubjectScopeCheck', { subjects });
if (code === 0 && data) {
const idList = data.map((v) => v.id);
const result = payload.filter((item) => {
if (item.type === 'depart') {
item.type = 'department';
if (!this.noVerifyRoutes.includes(this.$route.name)) {
const subjects = payload.map((item) => {
const { id, type, username } = item;
const typeMap = {
depart: () => {
return {
type: 'department',
id
};
},
user: () => {
return {
type: 'user',
id: username
};
}
return data.map((v) => v.type).includes(item.type)
&& (idList.includes(String(item.id)) || idList.includes(item.username));
});
return result;
};
return typeMap[type || mode]();
});
try {
const { code, data } = await this.$store.dispatch('organization/getSubjectScopeCheck', { subjects });
if (code === 0 && data) {
const idList = data.map((v) => v.id);
const result = payload.filter((item) => {
if (item.type === 'depart') {
item.type = 'department';
}
return data.map((v) => v.type).includes(item.type)
&& (idList.includes(String(item.id)) || idList.includes(item.username));
});
return result;
}
} catch (e) {
this.messageAdvancedError(e);
}
} catch (e) {
this.messageAdvancedError(e);
}
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/group/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
const addCustomList = this.originalList.filter(item => !temps.includes(item.$id));
addCustomList.forEach(item => {
if (!item.resource_groups || !item.resource_groups.length) {
item.resource_groups = item.related_resource_types.length ? [{ id: '', related_resource_types: item.related_resource_types }] : [];
item.resource_groups = item.related_resource_types && item.related_resource_types.length ? [{ id: '', related_resource_types: item.related_resource_types }] : [];
}
tempList.push(new GroupPolicy(item, 'add', 'custom', {
system: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
{ 'sub-item-none': !subItem.actions.length }
]"
>
<label class="sub-item-name" :title="subItem.name" v-if="subItem.actions && subItem.actions.length > 0">{{ subItem.name }}55</label>
<label class="sub-item-name" :title="subItem.name" v-if="subItem.actions && subItem.actions.length > 0">{{ subItem.name }}</label>
<div class="choose-perm-sub-tmpl">
<span v-for="subTmpl in subItem.actions" :key="subTmpl.$id">
<bk-checkbox
Expand Down
67 changes: 35 additions & 32 deletions frontend/src/views/my-manage-space/add-member-boundary/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@
manualTableList: [],
manualTableListStorage: [],
hasSelectedManualDepartments: [],
hasSelectedManualUsers: []
hasSelectedManualUsers: [],
noVerifyRoutes: ['authorBoundaryEditFirstLevel', 'authorBoundaryEditSecondLevel', 'applyJoinUserGroup', 'addMemberBoundary', 'gradingAdminCreate', 'gradingAdminEdit']
};
},
computed: {
Expand Down Expand Up @@ -1083,39 +1084,41 @@
// 校验部门/用户范围是否满足条件
async fetchSubjectScopeCheck (payload, mode) {
const subjects = payload.map((item) => {
const { id, type, username } = item;
const typeMap = {
depart: () => {
return {
type: 'department',
id
};
},
user: () => {
return {
type: 'user',
id: username
};
}
};
return typeMap[type || mode]();
});
try {
const { code, data } = await this.$store.dispatch('organization/getSubjectScopeCheck', { subjects });
if (code === 0 && data) {
const idList = data.map((v) => v.id);
const result = payload.filter((item) => {
if (item.type === 'depart') {
item.type = 'department';
if (!this.noVerifyRoutes.includes(this.$route.name)) {
const subjects = payload.map((item) => {
const { id, type, username } = item;
const typeMap = {
depart: () => {
return {
type: 'department',
id
};
},
user: () => {
return {
type: 'user',
id: username
};
}
return data.map((v) => v.type).includes(item.type)
&& (idList.includes(String(item.id)) || idList.includes(item.username));
});
return result;
};
return typeMap[type || mode]();
});
try {
const { code, data } = await this.$store.dispatch('organization/getSubjectScopeCheck', { subjects });
if (code === 0 && data) {
const idList = data.map((v) => v.id);
const result = payload.filter((item) => {
if (item.type === 'depart') {
item.type = 'department';
}
return data.map((v) => v.type).includes(item.type)
&& (idList.includes(String(item.id)) || idList.includes(item.username));
});
return result;
}
} catch (e) {
this.messageAdvancedError(e);
}
} catch (e) {
this.messageAdvancedError(e);
}
},
Expand Down
Loading

0 comments on commit 68b9c5a

Please sign in to comment.