You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.8 KiB
81 lines
1.8 KiB
<script setup lang="ts">
|
|
import type { IdentityUserDto } from '../../types';
|
|
import type {
|
|
IdentityClaimCreateDto,
|
|
IdentityClaimDeleteDto,
|
|
IdentityClaimUpdateDto,
|
|
} from '../../types/claims';
|
|
|
|
import { defineAsyncComponent } from 'vue';
|
|
|
|
import { useVbenModal } from '@vben/common-ui';
|
|
import { $t } from '@vben/locales';
|
|
|
|
import {
|
|
createClaimApi,
|
|
deleteClaimApi,
|
|
getClaimsApi,
|
|
updateClaimApi,
|
|
} from '../../api/users';
|
|
import { IdentityUserPermissions } from '../../constants/permissions';
|
|
|
|
defineOptions({
|
|
name: 'UserClaimModal',
|
|
});
|
|
|
|
const ClaimTable = defineAsyncComponent(
|
|
() => import('../claims/ClaimTable.vue'),
|
|
);
|
|
|
|
const [Modal, modalApi] = useVbenModal({
|
|
draggable: true,
|
|
fullscreenButton: false,
|
|
onCancel() {
|
|
modalApi.close();
|
|
},
|
|
onConfirm: async () => {},
|
|
showCancelButton: false,
|
|
showConfirmButton: false,
|
|
title: $t('AbpIdentity.ManageClaim'),
|
|
});
|
|
|
|
async function onGet() {
|
|
const { id } = modalApi.getData<IdentityUserDto>();
|
|
return await getClaimsApi(id);
|
|
}
|
|
|
|
async function onCreate(input: IdentityClaimCreateDto) {
|
|
const { id } = modalApi.getData<IdentityUserDto>();
|
|
await createClaimApi(id, input);
|
|
}
|
|
|
|
async function onDelete(input: IdentityClaimDeleteDto) {
|
|
const { id } = modalApi.getData<IdentityUserDto>();
|
|
await deleteClaimApi(id, input);
|
|
}
|
|
|
|
async function onUpdate(input: IdentityClaimUpdateDto) {
|
|
const { id } = modalApi.getData<IdentityUserDto>();
|
|
await updateClaimApi(id, input);
|
|
}
|
|
|
|
defineExpose({
|
|
modalApi,
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<Modal>
|
|
<ClaimTable
|
|
:create-api="onCreate"
|
|
:create-policy="IdentityUserPermissions.ManageClaims"
|
|
:delete-api="onDelete"
|
|
:delete-policy="IdentityUserPermissions.ManageClaims"
|
|
:get-api="onGet"
|
|
:update-api="onUpdate"
|
|
:update-policy="IdentityUserPermissions.ManageClaims"
|
|
/>
|
|
</Modal>
|
|
</template>
|
|
|
|
<style scoped></style>
|
|
|