Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ui/src/permission/modules/system/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ export default {
* 系统「外观设置」只读权限
*/
read: () => canSys(P.APPEARANCE_SETTINGS_READ) && hasEdition(Edition.PE),
/**
* 系统「外观设置」编辑权限
*/
edit: () => canSys(P.APPEARANCE_SETTINGS_EDIT)
}
18 changes: 18 additions & 0 deletions ui/src/permission/modules/system/chatUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,28 @@ export default {
* 系统「对话用户」只读权限
*/
read: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHAT_USER_READ],Compare.OR),
/**
* 系统「对话用户」创建权限
*/
create: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHAT_USER_CREATE],Compare.OR),
/**
* 系统「对话用户」同步权限
*/
sync: () => canSys(P.CHAT_USER_SYNC),
/**
* 系统「对话用户」编辑权限
*/
edit: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHAT_USER_EDIT],Compare.OR),
/**
* 系统「对话用户」删除权限
*/
delete: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHAT_USER_DELETE],Compare.OR),
/**
* 系统「对话用户」设置用户组权限
*/
userGroup: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.CHAT_USER_GROUP],Compare.OR),
/**
* 系统「对话用户」配额设置权限
*/
quotaSetting: () => canSys(P.CHAT_USER_QUOTA_SETTING),
}
17 changes: 15 additions & 2 deletions ui/src/permission/modules/system/chatUserGroup.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
/** 系统「对话用户组」按钮权限。$perm.chatUserGroup.* */

import { canSys } from '../../policy'
import { PermissionConstants as P, hasPermission, RoleConstants, Compare} from '../../core'

export default {
/**
* 系统「对话用户组」只读权限
*/
read: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.USER_GROUP_READ],Compare.OR),
/**
* 系统「对话用户组」创建权限
*/
create: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.USER_GROUP_CREATE],Compare.OR),
/**
* 系统「对话用户组」编辑权限
*/
edit: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.USER_GROUP_EDIT],Compare.OR),
/**
* 系统「对话用户组」删除权限
*/
delete: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.USER_GROUP_DELETE],Compare.OR),
/**
* 系统「对话用户组」添加成员权限
*/
addMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.USER_GROUP_ADD_MEMBER],Compare.OR),
/**
* 系统「对话用户组」移除成员权限
*/
removeMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.USER_GROUP_REMOVE_MEMBER],Compare.OR),
authRead: () => canSys(P.CHAT_USER_AUTH_READ),
}
6 changes: 5 additions & 1 deletion ui/src/permission/modules/system/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ export default {
/**
* 系统「邮箱设置」只读权限
*/
read: () => canSys(P.EMAIL_SETTING_READ), edit: () => canSys(P.EMAIL_SETTING_EDIT) }
read: () => canSys(P.EMAIL_SETTING_READ),
/**
* 系统「邮箱设置」编辑权限
*/
edit: () => canSys(P.EMAIL_SETTING_EDIT) }
3 changes: 3 additions & 0 deletions ui/src/permission/modules/system/loginAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ export default {
* 系统「用户认证」只读权限
*/
read: () => canSys(P.LOGIN_AUTH_READ) && hasEdition(Edition.PE),
/**
* 系统「用户认证」编辑权限
*/
edit: () => canSys(P.LOGIN_AUTH_EDIT)
}
10 changes: 9 additions & 1 deletion ui/src/permission/modules/system/operationLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ export default {
* 系统「操作日志」只读权限
*/
read: () => canSys(P.OPERATION_LOG_READ) && hasEdition(Edition.PE),
export: () => canSys(P.OPERATION_LOG_EXPORT), clearPolicy: () => canSys(P.OPERATION_LOG_CLEAR_POLICY) }
/**
* 系统「操作日志」导出权限
*/
export: () => canSys(P.OPERATION_LOG_EXPORT),
/**
* 系统「操作日志」清除策略权限
*/
clearPolicy: () => canSys(P.OPERATION_LOG_CLEAR_POLICY)
}
6 changes: 5 additions & 1 deletion ui/src/permission/modules/system/portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ export default {
/**
* 系统「门户访问设置」只读权限
*/
read: () => canSys(P.PORTAL_READ), edit: () => canSys(P.PORTAL_EDIT) }
read: () => canSys(P.PORTAL_READ),
/**
* 系统「门户访问设置」编辑权限
*/
edit: () => canSys(P.PORTAL_EDIT) }
15 changes: 15 additions & 0 deletions ui/src/permission/modules/system/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,24 @@ export default {
* 系统「角色管理」只读权限
* */
read: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.ROLE_READ],Compare.OR) && hasEdition(Edition.PE),
/**
* 系统「角色管理」创建权限
*/
create: () => canSys(P.ROLE_CREATE),
/**
* 系统「角色管理」编辑权限
*/
edit: () => canSys(P.ROLE_EDIT),
/**
* 系统「角色管理」删除权限
*/
delete: () => canSys(P.ROLE_DELETE),
/**
* 系统「角色管理」添加成员权限
*/
addMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.ROLE_ADD_MEMBER],Compare.OR),
/**
* 系统「角色管理」移除成员权限
*/
removeMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.ROLE_REMOVE_MEMBER],Compare.OR),
}
15 changes: 15 additions & 0 deletions ui/src/permission/modules/system/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@ export default {
* 系统「用户管理」只读权限
* */
read: () => canSys(P.USER_READ),
/**
* 系统「用户管理」创建权限
*/
create: () => canSys(P.USER_CREATE),
/**
* 系统「用户管理」编辑权限
*/
edit: () => canSys(P.USER_EDIT),
/**
* 系统「用户管理」删除权限
*/
delete: () => canSys(P.USER_DELETE),
/**
* 系统「用户管理」设置角色权限
*/
setRole: () => canSys(P.USER_SET_ROLE),
/**
* 系统「用户管理」导入权限
*/
import: () => canSys(P.USER_IMPORT),
}
15 changes: 15 additions & 0 deletions ui/src/permission/modules/system/userGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,24 @@ export default {
* 系统「用户组」只读权限
* */
read: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_USER_GROUP_READ],Compare.OR),
/**
* 系统「用户组」创建权限
*/
create: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_USER_GROUP_CREATE],Compare.OR),
/**
* 系统「用户组」编辑权限
*/
edit: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_USER_GROUP_EDIT],Compare.OR),
/**
* 系统「用户组」删除权限
*/
delete: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_USER_GROUP_DELETE],Compare.OR),
/**
* 系统「用户组」添加成员权限
*/
addMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_USER_GROUP_ADD_MEMBER],Compare.OR),
/**
* 系统「用户组」移除成员权限
*/
removeMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.SYSTEM_USER_GROUP_REMOVE_MEMBER],Compare.OR),
}
15 changes: 15 additions & 0 deletions ui/src/permission/modules/system/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,24 @@ export default {
* 系统「工作空间」只读权限
* */
read: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.WORKSPACE_READ],Compare.OR) && hasEdition(Edition.PE),
/**
* 系统「工作空间」创建权限
*/
create: () => canSys(P.WORKSPACE_CREATE),
/**
* 系统「工作空间」编辑权限
*/
edit: () => canSys(P.WORKSPACE_EDIT),
/**
* 系统「工作空间」删除权限
*/
delete: () => canSys(P.WORKSPACE_DELETE),
/**
* 系统「工作空间」添加成员权限
*/
addMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.WORKSPACE_ADD_MEMBER],Compare.OR),
/**
* 系统「工作空间」移除成员权限
*/
removeMember: () => hasPermission([RoleConstants.ADMIN,RoleConstants.WORKSPACE_MANAGE,P.WORKSPACE_REMOVE_MEMBER],Compare.OR),
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { FormInstance, FormRules } from 'element-plus'
import { LOGIN_METHOD_LABELS, SCAN_FIELD_LABELS } from '@/constants'
import { LOGIN_METHOD } from '@/api/enums'
import { MsgSuccess, MsgError } from '@/utils/message'
import perm from '@/permission'

const emit = defineEmits<{ refresh: [] }>()
const visible = ref(false)
Expand Down Expand Up @@ -82,7 +83,7 @@ defineExpose({ open })
<!-- 校验 -->
<el-button plain @click="handleValidatePlatform">校验</el-button>
<!-- 保存 -->
<el-button type="primary" @click="submit">保存</el-button>
<el-button v-if="perm.system.chatAuth.edit()" type="primary" @click="submit">保存</el-button>
</template>
</MkDrawer>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ChatUserAuthApi from '@/api/admin/system/chat-management/chat-user-auth'
import { LOGIN_METHOD } from '@/api/enums'
import type { AuthProviderSettingPayload } from '@/api/types'
import { MsgSuccess } from '@/utils/message'
import perm from '@/permission'

defineOptions({ name: 'CasAuthenticationSetting' })

Expand Down Expand Up @@ -72,6 +73,6 @@ onMounted(() => loadSetting)
<el-switch v-model="form.is_active" class="self-start" />
</div>
</el-form-item>
<el-button type="primary" @click="submit">保存</el-button>
<el-button v-if="perm.system.chatAuth.edit()" type="primary" @click="submit">保存</el-button>
</el-form>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ChatUserAuthApi from '@/api/admin/system/chat-management/chat-user-auth'
import { LOGIN_METHOD } from '@/api/enums'
import type { AuthProviderSettingPayload } from '@/api/types'
import { MsgSuccess } from '@/utils/message'
import perm from '@/permission'

defineOptions({ name: 'LdapAuthenticationSetting' })
const authFormRef = useTemplateRef<FormInstance>('authFormRef')
Expand Down Expand Up @@ -75,7 +76,7 @@ onMounted(() => loadSetting())
</el-form-item>
<div>
<!-- 保存 -->
<el-button type="primary" @click="submit('save')">保存</el-button>
<el-button v-if="perm.system.chatAuth.edit()" type="primary" @click="submit('save')">保存</el-button>
<!-- 测试连接 -->
<el-button plain @click="submit('test')">测试连接</el-button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ChatUserAuthApi from '@/api/admin/system/chat-management/chat-user-auth'
import { LOGIN_METHOD } from '@/api/enums'
import type { AuthProviderSettingPayload } from '@/api/types'
import { MsgSuccess } from '@/utils/message'
import perm from '@/permission'

defineOptions({ name: 'OidcAuthenticationSetting' })
const defaultRedirectUrl = `${window.location.origin}${window.MaxKB?.prefix ?? ''}/api/oauth2`
Expand Down Expand Up @@ -77,6 +78,6 @@ onMounted(() => loadSetting())
><div class="flex-column"><span>启用 OAuth2 认证</span><el-switch v-model="form.is_active" class="self-start" /></div
></el-form-item>
<!-- 保存 -->
<el-button type="primary" @click="submit">保存</el-button>
<el-button v-if="perm.system.chatAuth.edit()" type="primary" @click="submit">保存</el-button>
</el-form>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ChatUserAuthApi from '@/api/admin/system/chat-management/chat-user-auth'
import { LOGIN_METHOD } from '@/api/enums'
import type { AuthProviderSettingPayload } from '@/api/types'
import { MsgSuccess } from '@/utils/message'
import perm from '@/permission'

defineOptions({ name: 'OidcAuthenticationSetting' })
const defaultFieldMapping = '{"username":"preferred_username","email":"email"}'
Expand Down Expand Up @@ -96,6 +97,6 @@ onMounted(() => loadSetting())
><div class="flex-column"><span>启用 OIDC 认证</span><el-switch v-model="form.is_active" class="self-start" /></div
></el-form-item>
<!-- 保存 -->
<el-button type="primary" @click="submit">保存</el-button>
<el-button v-if="perm.system.chatAuth.edit()" type="primary" @click="submit">保存</el-button>
</el-form>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PortalPreview from './components/PortalPreview.vue'
import ButtonEditPortal from './components/ButtonEditPortal.vue'
import ButtonPortalAuthSetting from './components/ButtonPortalAuthSetting.vue'
import ButtonPortalCorsSetting from './components/ButtonPortalCorsSetting.vue'
import perm from '@/permission/index.ts'

type AccessField = 'enable_public_access' | 'enable_api' | 'enable_knowledge_base_api' | 'enable_auth' | 'enable_cors'

Expand Down Expand Up @@ -86,7 +87,7 @@ const previewLogo = computed(() => portalSetting.logo)
<h4 class="truncate" :title="previewName">{{ previewName }}</h4>
</div>
<!-- 编辑门户名称与 Logo -->
<ButtonEditPortal ref="editPortalButtonRef" :setting="portalSetting" :saving="saving" :save="savePortalSetting" />
<ButtonEditPortal v-if="perm.system.portal.edit()" ref="editPortalButtonRef" :setting="portalSetting" :saving="saving" :save="savePortalSetting" />
</el-card>
<el-card shadow="never">
<div class="space-y-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { MsgConfirm, MsgSuccess } from '@/utils/message'
import MkSearchList from '@/components/mk-search-list/index.vue'
import CreateGroupMemberDialog from './dialog/CreateGroupMemberDialog.vue'
import CreateOrUpdateGroupDialog from './dialog/CreateOrUpdateGroupDialog.vue'
import perm from '@/permission/index.ts'

/* 添加用户组表单dialog */
const groupDialogRef = useTemplateRef<InstanceType<typeof CreateOrUpdateGroupDialog>>('groupDialogRef')
Expand Down Expand Up @@ -136,20 +137,20 @@ onMounted(() => loadChatUserGroups())
<h4>{{ title }}</h4>
<!-- 创建用户组 -->
<MkTooltip content="创建用户组" placement="top">
<el-button text type="primary" @click="handleOpenGroupDialog()">
<el-button v-if="perm.system.chatUserGroup.create()" text type="primary" @click="handleOpenGroupDialog()">
<MkIcon name="icon_add_outlined" :size="18" />
</el-button>
</MkTooltip>
</component>
<MkSearchList :data="chatUserGroups" :default-active="currentGroup?.id" @click="handleGroupSelect">
<template #action-dropdown="{ row }">
<!-- 重命名用户组 -->
<MkDropdownItem @click="handleOpenGroupDialog(row)">
<MkDropdownItem v-if="perm.system.chatUserGroup.edit()" @click="handleOpenGroupDialog(row)">
<template #icon><MkIcon name="icon_rename_outlined" /></template>
<span>重命名</span>
</MkDropdownItem>
<!-- 删除用户组 -->
<MkDropdownItem divided @click="deleteGroup(row)">
<MkDropdownItem v-if="perm.system.chatUserGroup.delete()" divided @click="deleteGroup(row)">
<template #icon><MkIcon name="icon_delete-trash_outlined" /></template>
<span>删除</span>
</MkDropdownItem>
Expand All @@ -172,7 +173,7 @@ onMounted(() => loadChatUserGroups())
<div class="flex-between mb-4">
<div>
<!-- 添加成员 -->
<el-button type="primary" @click="handleOpenMemberDialog">
<el-button v-if="perm.system.chatUserGroup.addMember()" type="primary" @click="handleOpenMemberDialog">
<MkIcon name="icon_add_outlined" />
<span>添加成员</span>
</el-button>
Expand Down Expand Up @@ -203,15 +204,15 @@ onMounted(() => loadChatUserGroups())
<template #default="{ row }">
<!-- 移除成员 -->
<MkTooltip content="移除" placement="top">
<el-button type="primary" text @click="handleRemoveMembers(row)">
<el-button v-if="perm.system.chatUserGroup.removeMember()" type="primary" text @click="handleRemoveMembers(row)">
<MkIcon name="icon_assigned_outlined" />
</el-button>
</MkTooltip>
</template>
</el-table-column>
<template #footer-batch-actions>
<!-- 批量移除成员 -->
<el-button type="danger" plain @click="handleRemoveMembers()">移除</el-button>
<el-button v-if="perm.system.chatUserGroup.removeMember()" type="danger" plain @click="handleRemoveMembers()">移除</el-button>
</template>
</MkTable>
</template>
Expand Down
Loading
Loading