Skip to content

Commit 19b655e

Browse files
perf: Add user source column to the user list
1 parent b451d1f commit 19b655e

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

backend/apps/system/api/user.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ async def pager(
4848

4949
if oidlist:
5050
origin_stmt = origin_stmt.where(UserWsModel.oid.in_(oidlist))
51+
if origins:
52+
origin_stmt = origin_stmt.where(UserModel.origin.in_(origins))
5153
if status is not None:
5254
origin_stmt = origin_stmt.where(UserModel.status == status)
5355
if keyword:

frontend/src/views/system/user/User.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@
7676
</el-table-column>
7777
<el-table-column prop="email" show-overflow-tooltip :label="$t('user.email')" />
7878
<!-- <el-table-column prop="phone" :label="$t('user.phone_number')" width="280" /> -->
79-
<!-- <el-table-column prop="user_source" :label="$t('user.user_source')" width="280" /> -->
79+
<el-table-column prop="origin" :label="$t('user.user_source')" width="120">
80+
<template #default="scope">
81+
<span>{{ formatUserOrigin(scope.row.origin) }}</span>
82+
</template>
83+
</el-table-column>
8084
<el-table-column
8185
show-overflow-tooltip
8286
prop="oid_list"
@@ -425,13 +429,11 @@ const filterOption = ref<any[]>([
425429
type: 'enum',
426430
option: [
427431
{ id: '0', name: t('user.local_creation') },
428-
// { id: 1, name: 'LDAP' },
429-
// { id: 2, name: 'OIDC' },
430-
// { id: 3, name: 'CAS' },
431-
// { id: 9, name: 'OAuth2' },
432-
// { id: 4, name: t('user.feishu') },
433-
// { id: 5, name: t('user.dingtalk') },
434-
// { id: 6, name: t('user.wechat_for_business') },
432+
{ id: '1', name: 'CAS' },
433+
{ id: '2', name: 'OIDC' },
434+
{ id: '3', name: 'LDAP' },
435+
{ id: '4', name: 'OAuth2' },
436+
{ id: '5', name: 'SAML2' },
435437
],
436438
field: 'origins',
437439
title: t('user.user_source'),
@@ -824,6 +826,13 @@ const loadDefaultPwd = () => {
824826
}
825827
})
826828
}
829+
const formatUserOrigin = (origin?: number) => {
830+
if (!origin) {
831+
return t('user.local_creation')
832+
}
833+
const originArray = ['CAS', 'OIDC', 'LDAP', 'OAuth2', 'SAML2']
834+
return originArray[origin - 1]
835+
}
827836
onMounted(() => {
828837
workspaceList().then((res) => {
829838
options.value = res || []

0 commit comments

Comments
 (0)