diff --git a/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogDrawer.vue b/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogDrawer.vue
index 64615127e..c94899610 100644
--- a/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogDrawer.vue
+++ b/apps/vben5/packages/@abp/auditing/src/components/audit-logs/AuditLogDrawer.vue
@@ -148,17 +148,43 @@ async function onGet(id: string) {
{{ auditLogModel.userName }}
-
-
- {{ auditLogModel.httpMethod }}
-
+
+
+ {{ auditLogModel.tenantId }}/{{ auditLogModel.tenantName }}
+
+
+
+
+ {{ auditLogModel.impersonatorTenantId }}/{{
+ auditLogModel.impersonatorTenantName
+ }}
+
+
+
+ {{ auditLogModel.impersonatorUserId }}/{{
+ auditLogModel.impersonatorUserName
+ }}
+
+
{{ auditLogModel.url }}
+
+
+ {{ auditLogModel.httpMethod }}
+
+
= {
sortable: true,
title: $t('AbpIdentity.DisplayName:SessionId'),
},
+ {
+ align: 'left',
+ field: 'userId',
+ formatter: ({ row }) => {
+ if (row.extraProperties?.UserName) {
+ return `${row.extraProperties.UserName} (${row.userId})`;
+ }
+ return row.userId;
+ },
+ minWidth: 150,
+ sortable: true,
+ title: $t('AbpIdentity.DisplayName:UserId'),
+ },
{
align: 'left',
field: 'device',
@@ -98,7 +111,7 @@ const gridOptions: VxeGridProps = {
field: 'deviceInfo',
sortable: true,
title: $t('AbpIdentity.DisplayName:DeviceInfo'),
- width: 'auto',
+ minWidth: 200,
},
{
align: 'left',
diff --git a/apps/vben5/packages/@abp/identity/src/components/users/UserTable.vue b/apps/vben5/packages/@abp/identity/src/components/users/UserTable.vue
index ae80c72c6..d57867cc1 100644
--- a/apps/vben5/packages/@abp/identity/src/components/users/UserTable.vue
+++ b/apps/vben5/packages/@abp/identity/src/components/users/UserTable.vue
@@ -61,20 +61,68 @@ const PermissionsOutlined = createIconifyIcon('icon-park-outline:permissions');
const SessionIcon = createIconifyIcon('carbon:prompt-session');
const AuditLogIcon = createIconifyIcon('fluent-mdl2:compliance-audit');
-const getLockEnd = computed(() => {
- return (row: IdentityUserDto) => {
- if (row.lockoutEnd) {
- const lockTime = new Date(row.lockoutEnd);
- if (lockTime) {
- // 锁定时间高于当前时间不显示
- const nowTime = new Date();
- return lockTime < nowTime;
- }
+const isCurrentUser = (user: IdentityUserDto) => {
+ return abpStore.application?.currentUser.id === user.id;
+};
+
+const getLockEnd = (row: IdentityUserDto) => {
+ if (row.lockoutEnd) {
+ const lockTime = new Date(row.lockoutEnd);
+ if (lockTime) {
+ // 锁定时间高于当前时间不显示
+ const nowTime = new Date();
+ return lockTime < nowTime;
}
- return true;
+ }
+ return true;
+};
+
+const isDeleteEnabled = computed(() => {
+ return (user: IdentityUserDto) => {
+ return (
+ !isCurrentUser(user) && hasAccessByCodes([IdentityUserPermissions.Delete])
+ );
+ };
+});
+
+const isLockEnabled = computed(() => {
+ return (user: IdentityUserDto) => {
+ return (
+ !isCurrentUser(user) &&
+ user.isActive &&
+ getLockEnd(user) &&
+ hasAccessByCodes([IdentityUserPermissions.Update])
+ );
+ };
+});
+
+const isUnLockEnabled = computed(() => {
+ return (user: IdentityUserDto) => {
+ return (
+ !isCurrentUser(user) &&
+ user.isActive &&
+ !getLockEnd(user) &&
+ hasAccessByCodes([IdentityUserPermissions.Update])
+ );
+ };
+});
+
+const isImpersonationEnabled = computed(() => {
+ return (user: IdentityUserDto) => {
+ return (
+ !isCurrentUser(user) &&
+ hasAccessByCodes([IdentityUserPermissions.Impersonation])
+ );
};
});
+const isAuditLogEnabled = computed(() => {
+ return (
+ isEnabled('AbpAuditing.Logging.AuditLog') &&
+ hasAccessByCodes([AuditLogPermissions.Default])
+ );
+});
+
const abpStore = useAbpStore();
const { isEnabled } = useFeatures();
const { hasAccessByCodes } = useAccess();
@@ -385,7 +433,7 @@ const handleMenuClick = async (row: IdentityUserDto, info: MenuInfo) => {
block
danger
type="link"
- v-access:code="[IdentityUserPermissions.Delete]"
+ :disabled="!isDeleteEnabled(row)"
@click="handleDelete(row)"
>
{{ $t('AbpUi.Delete') }}
@@ -396,22 +444,14 @@ const handleMenuClick = async (row: IdentityUserDto, info: MenuInfo) => {