This commit is contained in:
@@ -105,7 +105,7 @@ export default {
|
||||
return o == oType;
|
||||
});
|
||||
|
||||
//Get the AyaNova stock role rights for that object
|
||||
//Get the AyaNova stock REQUIRED role rights for that object
|
||||
let objectRoleRights = this.ROLE_RIGHTS[typeName];
|
||||
|
||||
//get the logged in user's role
|
||||
@@ -121,6 +121,14 @@ export default {
|
||||
ret.read = canReadFullRecord;
|
||||
|
||||
return ret;
|
||||
},
|
||||
/////////////////////////////////
|
||||
// convenience method for forms that deal with multiple object types
|
||||
// (i.e. grids, history etc)
|
||||
//
|
||||
canOpen(oType) {
|
||||
let r = this.getRights(oType);
|
||||
return r.read;
|
||||
}
|
||||
};
|
||||
/*
|
||||
|
||||
@@ -9,6 +9,44 @@
|
||||
|
||||
<v-col rows="12">
|
||||
<template v-if="$route.params.userlog">
|
||||
<!-- **** USER LOG ****** -->
|
||||
<v-timeline :dense="$vuetify.breakpoint.smAndDown">
|
||||
<v-timeline-item
|
||||
v-for="i in obj"
|
||||
:key="i.index"
|
||||
fill-dot
|
||||
:color="getIconColorForEvent(i.event)"
|
||||
:icon="getIconForEvent(i.event)"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title>{{ i.name }}</v-card-title>
|
||||
<v-card-subtitle
|
||||
>{{ i.date }} - {{ getEventName(i.event) }}</v-card-subtitle
|
||||
>
|
||||
<v-card-text
|
||||
><v-icon large class="mr-2">{{
|
||||
getIconForObjectType(i.objectType)
|
||||
}}</v-icon
|
||||
>{{ getNameForType(i.objectType) }}
|
||||
<div class="mt-4" v-if="i.textra">{{ i.textra }}</div>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn text @click="openHistoryOfItem(i)">{{
|
||||
$ay.t("History")
|
||||
}}</v-btn>
|
||||
<v-btn
|
||||
v-if="canOpen(i.objectType)"
|
||||
text
|
||||
@click="openItem(i)"
|
||||
>{{ $ay.t("Open") }}</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-timeline-item>
|
||||
</v-timeline>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- **** OBJECT LOG ****** -->
|
||||
<v-timeline :dense="$vuetify.breakpoint.smAndDown">
|
||||
<v-timeline-item
|
||||
v-for="i in obj"
|
||||
@@ -31,21 +69,20 @@
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-btn text @click="openHistoryOfItem(i)">{{
|
||||
$ay.t("History")
|
||||
}}</v-btn>
|
||||
<v-btn
|
||||
v-if="canOpen(i.objectType)"
|
||||
v-if="canViewUserHistory(i)"
|
||||
text
|
||||
@click="openItem(i)"
|
||||
>{{ $ay.t("Open") }}</v-btn
|
||||
@click="openHistoryOfItem(i)"
|
||||
>{{ $ay.t("History") }}</v-btn
|
||||
>
|
||||
<v-btn v-if="canOpenUser" text @click="openItem(i)">{{
|
||||
$ay.t("Open")
|
||||
}}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-timeline-item>
|
||||
</v-timeline>
|
||||
</template>
|
||||
<template v-else>ObjectLog </template>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-btn
|
||||
@@ -96,6 +133,7 @@ export default {
|
||||
ayaTypes: {},
|
||||
page: -1, //Note this must be -1 at start to work properly
|
||||
moreAvailable: true,
|
||||
canOpenUser: window.$gz.role.canOpen(window.$gz.type.User),
|
||||
formState: {
|
||||
ready: false,
|
||||
loading: false,
|
||||
@@ -118,8 +156,17 @@ export default {
|
||||
params: { ayatype: item.objectType, recordid: item.objectId }
|
||||
});
|
||||
},
|
||||
canViewUserHistory(objectlogitem) {
|
||||
//For object log to decide if view history of user in item is allowed
|
||||
//if user has full read role to User or it's themselves then they can
|
||||
return (
|
||||
this.canOpenUser || this.$store.state.userId == objectlogitem.userId
|
||||
);
|
||||
},
|
||||
canOpen(otype) {
|
||||
return this.ayaTypes[otype].canopen;
|
||||
return (
|
||||
this.ayaTypes[otype].openableObject && window.$gz.role.canOpen(otype)
|
||||
);
|
||||
},
|
||||
getIconForPage() {
|
||||
let vm = this;
|
||||
@@ -322,20 +369,20 @@ function populateAyaTypeList(vm) {
|
||||
let temp = {};
|
||||
for (let i = 0; i < ayt.length; i++) {
|
||||
let item = ayt[i];
|
||||
let canopen = false;
|
||||
let openableObject = false;
|
||||
//CoreBizObject add here
|
||||
switch (item.id) {
|
||||
case window.$gz.type.User:
|
||||
case window.$gz.type.Widget:
|
||||
canopen = true;
|
||||
openableObject = true;
|
||||
break;
|
||||
default:
|
||||
canopen = false;
|
||||
openableObject = false;
|
||||
}
|
||||
temp[item.id] = {
|
||||
name: item.name,
|
||||
icon: window.$gz.util.iconForType(item.id),
|
||||
canopen: canopen
|
||||
openableObject: openableObject
|
||||
};
|
||||
}
|
||||
vm.ayaTypes = temp;
|
||||
|
||||
Reference in New Issue
Block a user