Skip to content

Commit

Permalink
Merge pull request #2754 from lhzzforever/dev/develop_ci
Browse files Browse the repository at this point in the history
fix: 修复7-24版本体验问题
  • Loading branch information
ielgnaw authored Jul 18, 2024
2 parents 62d987d + 57fad33 commit 77c0410
Show file tree
Hide file tree
Showing 18 changed files with 253 additions and 213 deletions.
183 changes: 183 additions & 0 deletions frontend/src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,109 @@ export const NEED_CONFIRM_DIALOG_ROUTER = [
'secondaryManageSpaceCreate'
];

// 不同导航栏下的路由模块分类
export const ALL_ROUTES_LIST = new Map([
// 权限模板
[
['permTemplate', 'permTemplateDetail', 'permTemplateCreate', 'permTemplateEdit', 'permTemplateDiff'],
'permTemplateNav'
],
// 首页
[['', 'index'], 'indexNav'],
// 用户组
[
['userGroup', 'userGroupDetail', 'createUserGroup', 'cloneUserGroup', 'userGroupPermDetail', 'groupPermRenewal', 'addGroupPerm'],
'userGroupNav'
],
// 系统接入
[
[
'systemAccess',
'systemAccessCreate',
'systemAccessAccess',
'systemAccessRegistry',
'systemAccessOptimize',
'systemAccessComplete'
],
'systemAccessNav'
],
// 我的申请
[['apply'], 'applyNav'],
// 权限申请 'permApply'
[['applyCustomPerm', 'applyJoinUserGroup'], 'permApplyNav'],
// 临时权限申请 'provisionPermApply'
[['applyProvisionPerm'], 'provisionPermApplyNav'],
// 我的权限
[
[
'myPerm',
'templatePermDetail',
'groupPermDetail',
'permRenewal',
'groupPermRenewal',
'permTransfer',
'permTransferHistory',
'applyPerm'
],
'myPermNav'
],
// 我的管理空间
[['myManageSpace', 'myManageSpaceCreate', 'gradingAdminDetail', 'gradingAdminEdit', 'gradingAdminCreate', 'myManageSpaceSubDetail', 'secondaryManageSpaceEdit'], 'myManageSpaceNav'],
// 分级管理员
[['ratingManager', 'gradingAdminDetail', 'gradingAdminCreate', 'gradingAdminEdit'], 'gradingAdminNav'],
// 二级管理空间
[['secondaryManageSpace', 'secondaryManageSpaceCreate', 'secondaryManageSpaceDetail'], 'secondaryManageSpaceNav'],
// 授权边界
[['authorBoundary', 'authorBoundaryEditFirstLevel', 'authorBoundaryEditSecondLevel'], 'authorBoundaryNav'],
// 最大可授权人员边界
[['addMemberBoundary'], 'addMemberBoundaryNav'],
// 资源权限
[['resourcePermiss'], 'resourcePermissNav'],
// 管理员
[['administrator'], 'settingNav'],
// 审批流程
[['approvalProcess'], 'approvalProcessNav'],
// 用户
[['user'], 'userNav'],
// 审计
[['audit'], 'auditNav'],
// 用户组设置
[['userGroupSetting'], 'userGroupSettingNav'],
// 敏感等级
[['sensitivityLevel'], 'sensitivityLevelNav'],
// 人员模板
[['memberTemplate'], 'memberTemplateNav'],
// 管理空间下资源权限管理
[['resourcePermManage'], 'resourcePermManageNav'],
// 用户/组织
[['userOrgPerm'], 'userOrgPermNav'],
// 续期通知
[['renewalNotice'], 'renewalNoticeNav']
]);

// 切换管理员身份需要重定向的页面
export const MANAGE_SPACE_REDIRECT_ROUTES = new Map([
// 权限模板
[
['permTemplateDetail', 'permTemplateCreate', 'permTemplateEdit', 'permTemplateDiff'],
'permTemplate'
],
// 用户组模块
[
['userGroupDetail', 'createUserGroup', 'cloneUserGroup', 'userGroupPermDetail', 'groupPermRenewal', 'addGroupPerm'],
'userGroup'
],
// 管理空间
[
['gradingAdminDetail', 'gradingAdminCreate', 'gradingAdminEdit'],
'ratingManager'],
// 二级管理员
[
['secondaryManageSpaceCreate', 'secondaryManageSpaceDetail', 'secondaryManageSpaceEdit'],
'secondaryManageSpace'
]
]);

// 用户组属性枚举
export const USER_GROUP_ATTRIBUTES = [
{
Expand Down Expand Up @@ -273,3 +376,83 @@ export const SEND_DAYS_LIST = [
value: 'sunday'
}
];

// 只显示角色名称的审计类型
export const ONLY_ROLE_TYPE = [
'template.create',
'subject.template.create',
'subject.template.delete'
];

// 没有详情的审计类型
export const NO_DETAIL_TYPE = [
'group.create',
'group.delete',
// 'template.create',
'template.update',
'role.create'
];

// 只有描述字段的审计类型
export const ONLY_DESCRIPTION_TYPE = [
'group.update',
'role.update',
'role.member.policy.create',
'role.member.policy.delete',
'approval.global.update'
];

// 只有子对象的审计类型
export const ONLY_SUB_TYPE = [
'action.sensitivity.level.update',
'group.template.create',
'group.member.create',
'group.member.delete',
'group.member.renew',
'group.transfer',
'user.group.delete',
'department.group.delete',
'user.role.delete',
'role.member.create',
'role.member.delete',
'role.member.update',
'role.commonaction.create',
'role.commonaction.delete',
'subject.template.group.delete',
'subject.template.member.create',
'subject.template.member.delete'
];

// 只有附加信息的审计类型
export const ONLY_EXTRA_INFO_TYPE = [
'group.policy.create',
'group.policy.delete',
'group.policy.update',
'user.policy.delete',
'user.policy.create',
'user.policy.update',
'user.temporary.policy.create',
'user.temporary.policy.delete',
'user.blacklist.member.create',
'user.blacklist.member.delete',
'user.permission.clean',
'role.group.renew',
'template.version.sync'
];

// 既有 description 又有 extra_info
export const DE_TYPR = ['template.update'];

// 既有 sub_objects 又有 extra_info
export const SE_TYPE = [
'template.member.create',
'template.member.delete',
'template.version.update'
];

// 既有 description 又有 sub_objects
export const DS_TYPE = [
'approval.action.update',
'approval.group.update',
'template.preupdate.create'
];
2 changes: 1 addition & 1 deletion frontend/src/components/choose-ip/sideslider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@
}
}
.bk-sideslider-footer {
background-color: #f5f6fa!important;
background-color: #ffffff !important;
border-color: #dcdee5!important;
}
}
Expand Down
109 changes: 15 additions & 94 deletions frontend/src/components/nav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
]"
:title="data.name"> -->
<div
v-bkloading="{ isLoading: data.subManageLoading, opacity: 1 }"
:class="[
'single-hide',
{ 'iam-search-data': isSearch }
Expand Down Expand Up @@ -197,92 +196,12 @@
import { bus } from '@/common/bus';
// import { getTreeNode } from '@/common/util';
import { getRouterDiff } from '@/common/router-handle';
import { NEED_CONFIRM_DIALOG_ROUTER } from '@/common/constants';
import { NEED_CONFIRM_DIALOG_ROUTER, MANAGE_SPACE_REDIRECT_ROUTES, ALL_ROUTES_LIST } from '@/common/constants';
import { leavePageConfirm } from '@/common/leave-page-confirm';
import IamGuide from '@/components/iam-guide/index.vue';
const routerMap = new Map([
// 权限模板
[
['permTemplate', 'permTemplateDetail', 'permTemplateCreate', 'permTemplateEdit', 'permTemplateDiff'],
'permTemplateNav'
],
// 首页
[['', 'index'], 'indexNav'],
// 用户组
[
['userGroup', 'userGroupDetail', 'createUserGroup', 'cloneUserGroup', 'userGroupPermDetail', 'groupPermRenewal', 'addGroupPerm'],
'userGroupNav'
],
// 系统接入
[
[
'systemAccess',
'systemAccessCreate',
'systemAccessAccess',
'systemAccessRegistry',
'systemAccessOptimize',
'systemAccessComplete'
],
'systemAccessNav'
],
// 我的申请
[['apply'], 'applyNav'],
// 权限申请 'permApply'
[['applyCustomPerm', 'applyJoinUserGroup'], 'permApplyNav'],
// 临时权限申请 'provisionPermApply'
[['applyProvisionPerm'], 'provisionPermApplyNav'],
// 我的权限
[
[
'myPerm',
'templatePermDetail',
'groupPermDetail',
'permRenewal',
'groupPermRenewal',
'permTransfer',
'permTransferHistory',
'applyPerm'
],
'myPermNav'
],
// 我的管理空间
[['myManageSpace', 'myManageSpaceCreate', 'gradingAdminDetail', 'gradingAdminEdit', 'gradingAdminCreate', 'myManageSpaceSubDetail', 'secondaryManageSpaceEdit'], 'myManageSpaceNav'],
// 分级管理员
[['ratingManager', 'gradingAdminDetail', 'gradingAdminCreate', 'gradingAdminEdit'], 'gradingAdminNav'],
// 二级管理空间
[['secondaryManageSpace', 'secondaryManageSpaceCreate', 'secondaryManageSpaceDetail'], 'secondaryManageSpaceNav'],
// 授权边界
[['authorBoundary', 'authorBoundaryEditFirstLevel', 'authorBoundaryEditSecondLevel'], 'authorBoundaryNav'],
// 最大可授权人员边界
[['addMemberBoundary'], 'addMemberBoundaryNav'],
// 资源权限
[['resourcePermiss'], 'resourcePermissNav'],
// 管理员
[['administrator'], 'settingNav'],
// 审批流程
[['approvalProcess'], 'approvalProcessNav'],
// 用户
[['user'], 'userNav'],
// 审计
[['audit'], 'auditNav'],
// 用户组设置
[['userGroupSetting'], 'userGroupSettingNav'],
// 敏感等级
[['sensitivityLevel'], 'sensitivityLevelNav'],
// 人员模板
[['memberTemplate'], 'memberTemplateNav'],
// 管理空间下资源权限管理
[['resourcePermManage'], 'resourcePermManageNav'],
// 用户/组织
[['userOrgPerm'], 'userOrgPermNav'],
// 续期通知
[['renewalNotice'], 'renewalNoticeNav']
]);
export default {
inject: ['reload'],
name: '',
components: {
IamGuide
},
Expand All @@ -293,9 +212,10 @@
timer: null,
curRole: 'staff',
isUnfold: true,
routerMap: routerMap,
routerMap: Object.freeze(ALL_ROUTES_LIST),
curRoleList: [],
subRoleList: [],
manageSpaceRoutes: Object.freeze(MANAGE_SPACE_REDIRECT_ROUTES),
curRoleId: 0,
hoverId: -1,
selectValue: '',
Expand Down Expand Up @@ -763,6 +683,11 @@
return;
}
if (item.path === this.$route.path) {
// 因为vuex是同步操作,需要从缓存里获取最新的位置处理多个标签页之间不同权限页面之间的切换场景
const storageNavIndex = window.localStorage.getItem('index');
if (this.index !== storageNavIndex) {
return;
}
bus.$emit('reload-page', item);
this.$emit('reload-page', this.$route);
return;
Expand Down Expand Up @@ -800,18 +725,14 @@
});
return;
}
const permTemplateRoutes = ['permTemplateCreate', 'permTemplateDetail', 'permTemplateEdit', 'permTemplateDiff'];
if (permTemplateRoutes.includes(curRouterName)) {
this.$router.push({ name: 'permTemplate' });
return;
}
if (['createUserGroup', 'cloneUserGroup', 'userGroupDetail', 'addGroupPerm'].includes(curRouterName)) {
this.$router.push({ name: 'userGroup' });
return;
let resetRouteName = '';
for (const [key, value] of this.manageSpaceRoutes.entries()) {
if (key.includes(curRouterName)) {
resetRouteName = value;
}
}
if (['gradingAdminDetail', 'gradingAdminEdit', 'gradingAdminCreate'].includes(curRouterName)) {
this.$router.push({ name: 'ratingManager' });
if (resetRouteName) {
this.$router.push({ name: resetRouteName });
return;
}
this.$emit('reload-page', this.$route);
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ export const beforeEach = async (to, from, next) => {
} else {
// 单独处理返回个人staff不需要重定向我的权限的路由
const routeNavMap = [
[(name) => !getNavRouterDiff(0).includes(name), () => next()],
[(name) => ['ratingManager'].includes(name), () => next({ path: `${SITE_URL}${to.fullPath}` })]
[(name) => !getNavRouterDiff(0).includes(name), () => next()]
];
const getRouteNav = routeNavMap.find((item) => item[0](to.name));
if (getRouteNav) {
Expand Down
Loading

0 comments on commit 77c0410

Please sign in to comment.