@drax/identity-vue 0.30.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.33.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"format": "prettier --write src/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@drax/common-front": "^0.
|
|
28
|
-
"@drax/common-vue": "^0.
|
|
29
|
-
"@drax/crud-front": "^0.
|
|
30
|
-
"@drax/crud-share": "^0.
|
|
31
|
-
"@drax/crud-vue": "^0.
|
|
32
|
-
"@drax/identity-share": "^0.
|
|
27
|
+
"@drax/common-front": "^0.33.0",
|
|
28
|
+
"@drax/common-vue": "^0.33.0",
|
|
29
|
+
"@drax/crud-front": "^0.33.0",
|
|
30
|
+
"@drax/crud-share": "^0.33.0",
|
|
31
|
+
"@drax/crud-vue": "^0.33.0",
|
|
32
|
+
"@drax/identity-share": "^0.33.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"pinia": "^2.2.2",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"vue-tsc": "^2.1.6",
|
|
67
67
|
"vuetify": "^3.7.1"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "2a006597a635f61776d252f92bb3899371244379"
|
|
70
70
|
}
|
|
@@ -22,11 +22,11 @@ class RoleCrud extends EntityCrud implements IEntityCrud {
|
|
|
22
22
|
|
|
23
23
|
get permissions(){
|
|
24
24
|
return {
|
|
25
|
-
manage: '
|
|
26
|
-
view: '
|
|
27
|
-
create: '
|
|
28
|
-
update: '
|
|
29
|
-
delete: '
|
|
25
|
+
manage: 'role:manage',
|
|
26
|
+
view: 'role:view',
|
|
27
|
+
create: 'role:create',
|
|
28
|
+
update: 'role:update',
|
|
29
|
+
delete: 'role:delete'
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -4,6 +4,11 @@ import {EntityCrud} from "@drax/crud-vue";
|
|
|
4
4
|
import {UserSystemFactory} from "@drax/identity-front";
|
|
5
5
|
import {RoleCrud} from '../role-crud/RoleCrud'
|
|
6
6
|
import {TenantCrud} from '../tenant-crud/TenantCrud'
|
|
7
|
+
import {useAuthStore} from '../../stores/auth/AuthStore'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
7
12
|
import type {
|
|
8
13
|
IEntityCrud,
|
|
9
14
|
IEntityCrudField,
|
|
@@ -31,11 +36,11 @@ class UserCrud extends EntityCrud implements IEntityCrud {
|
|
|
31
36
|
|
|
32
37
|
get permissions(){
|
|
33
38
|
return {
|
|
34
|
-
manage: '
|
|
35
|
-
view: '
|
|
36
|
-
create: '
|
|
37
|
-
update: '
|
|
38
|
-
delete: '
|
|
39
|
+
manage: 'user:manage',
|
|
40
|
+
view: 'user:view',
|
|
41
|
+
create: 'user:create',
|
|
42
|
+
update: 'user:update',
|
|
43
|
+
delete: 'user:delete'
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
|
|
@@ -75,7 +80,7 @@ class UserCrud extends EntityCrud implements IEntityCrud {
|
|
|
75
80
|
{name: 'email', type: 'string', label: 'email', default:'' },
|
|
76
81
|
{name: 'phone', type: 'string', label: 'phone', default:'' },
|
|
77
82
|
{name: 'role', type: 'ref', ref: 'role', label: 'role', default:null },
|
|
78
|
-
{name: 'tenant', type: 'ref', ref: 'tenant', label: 'tenant', default:null },
|
|
83
|
+
{name: 'tenant', type: 'ref', ref: 'tenant', label: 'tenant', default:null, permission: 'tenant:manage' },
|
|
79
84
|
{name: 'active', type: 'boolean', label: 'active', default:true },
|
|
80
85
|
|
|
81
86
|
]
|
|
@@ -106,6 +111,20 @@ class UserCrud extends EntityCrud implements IEntityCrud {
|
|
|
106
111
|
get isImportable(){
|
|
107
112
|
return false
|
|
108
113
|
}
|
|
114
|
+
|
|
115
|
+
get isEditable(){
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
isItemEditable(item?:any) {
|
|
120
|
+
const authStore = useAuthStore()
|
|
121
|
+
if(authStore?.authUser?.role?.childRoles){
|
|
122
|
+
return authStore.authUser.role.childRoles.some(role => role.name === item.role.name)
|
|
123
|
+
}else{
|
|
124
|
+
return true
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
109
128
|
}
|
|
110
129
|
|
|
111
130
|
export default UserCrud
|
|
@@ -4,12 +4,15 @@ import {defineEmits, defineModel, defineProps, type PropType, ref} from "vue";
|
|
|
4
4
|
import {useI18nValidation} from "@drax/common-vue";
|
|
5
5
|
import RoleCombobox from "../../combobox/RoleCombobox.vue";
|
|
6
6
|
import TenantCombobox from "../../combobox/TenantCombobox.vue";
|
|
7
|
+
import {useAuth} from "../../composables/useAuth";
|
|
7
8
|
import {useI18n} from "vue-i18n";
|
|
8
9
|
import type {IEntityCrudOperation} from "@drax/crud-share";
|
|
9
10
|
|
|
10
11
|
const {$ta} = useI18nValidation()
|
|
11
12
|
const {t, te} = useI18n()
|
|
12
13
|
|
|
14
|
+
const {hasPermission} = useAuth()
|
|
15
|
+
|
|
13
16
|
const {operation} = defineProps({
|
|
14
17
|
operation: {type: String as PropType<IEntityCrudOperation>, required: true},
|
|
15
18
|
enablePassword: {type: Boolean, default: false}
|
|
@@ -119,6 +122,7 @@ let passwordVisibility = ref(false)
|
|
|
119
122
|
></RoleCombobox>
|
|
120
123
|
|
|
121
124
|
<TenantCombobox
|
|
125
|
+
v-if="hasPermission('tenant:manage')"
|
|
122
126
|
v-model="valueModel.tenant"
|
|
123
127
|
:label="t('user.field.tenant')"
|
|
124
128
|
:variant="variant"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {ref} from "vue"
|
|
3
3
|
import UserCrud from "../../cruds/user-crud/UserCrud";
|
|
4
|
+
import {useAuth} from "../../composables/useAuth";
|
|
4
5
|
import {Crud, useCrud} from "@drax/crud-vue";
|
|
5
6
|
import UserForm from "../../cruds/user-crud/UserForm.vue";
|
|
6
7
|
import PasswordUpdateButton from "../../cruds/user-crud/PasswordUpdateButton.vue";
|
|
@@ -12,6 +13,8 @@ const {onCancel, onSubmit,form, operation } = useCrud(UserCrud.instance);
|
|
|
12
13
|
const dialogPassword = ref(false);
|
|
13
14
|
const userSelected = ref();
|
|
14
15
|
|
|
16
|
+
const {hasPermission } = useAuth();
|
|
17
|
+
|
|
15
18
|
function onChangePassword(user:IUser){
|
|
16
19
|
console.log("onChangePassword for user: ", user);
|
|
17
20
|
userSelected.value = user;
|
|
@@ -43,7 +46,9 @@ function onChangePassword(user:IUser){
|
|
|
43
46
|
|
|
44
47
|
|
|
45
48
|
<template v-slot:item.actions="{ item }">
|
|
46
|
-
<password-update-button
|
|
49
|
+
<password-update-button v-if="hasPermission('user:changePassword')"
|
|
50
|
+
@click="onChangePassword(item as IUser)"
|
|
51
|
+
></password-update-button>
|
|
47
52
|
</template>
|
|
48
53
|
|
|
49
54
|
|