diff --git a/ayanova/src/api/authorizationroles.js b/ayanova/src/api/authorizationroles.js index b9d062f6..907bff60 100644 --- a/ayanova/src/api/authorizationroles.js +++ b/ayanova/src/api/authorizationroles.js @@ -2,29 +2,30 @@ import _ from "../libs/lodash.min.js"; import store from "../store"; + export default { - AYATYPE: { - NoType: 0, - Global: 1, - Widget: 2, - User: 3, - ServerState: 4, - License: 5, - LogFile: 6, - DEPRECATED_REUSELATER_7: 7, - DEPRECATED_REUSELATER_8: 8, - JobOperations: 9, - AyaNova7Import: 10, - TrialSeeder: 11, - Metrics: 12, - Locale: 13, - UserOptions: 14, - DEPRECATED_REUSELATER_15: 15, - DEPRECATED_REUSELATER_16: 16, - FileAttachment: 17, - DataFilter: 18, - FormCustom: 19 - }, + // AYATYPE: { + // NoType: 0, + // Global: 1, + // Widget: 2, + // User: 3, + // ServerState: 4, + // License: 5, + // LogFile: 6, + // DEPRECATED_REUSELATER_7: 7, + // DEPRECATED_REUSELATER_8: 8, + // JobOperations: 9, + // AyaNova7Import: 10, + // TrialSeeder: 11, + // Metrics: 12, + // Locale: 13, + // UserOptions: 14, + // DEPRECATED_REUSELATER_15: 15, + // DEPRECATED_REUSELATER_16: 16, + // FileAttachment: 17, + // DataFilter: 18, + // FormCustom: 19 + // }, AUTHORIZATION_ROLES: { ///No role set NoRole: 0, @@ -65,7 +66,7 @@ export default { } return role === (store.state.roles & role); }, - rights(userRole, oType, oId) { + rights(vm, userRole, oType, oId) { //NOTE: this is to mirror the functionality of BizRoles.cs where all rights by role are specified in server project //any change there needs to be mirrored here @@ -85,14 +86,19 @@ export default { delete: false }; + //ISSUE: I keep seeing imports as undefined other than underscore in here, no idea why + //Maybe I need to combine rights and types and roles into a single object that I can reach off the VM / MAIN + //TODO, put this somewhere else var AYANOVA_RIGHTS = JSON.parse( '{"User":{"Change":2,"EditOwn":0,"ReadFullRecord":1},"UserOptions":{"Change":2,"EditOwn":0,"ReadFullRecord":1},"Widget":{"Change":34,"EditOwn":256,"ReadFullRecord":17},"ServerState":{"Change":16384,"EditOwn":0,"ReadFullRecord":32767},"License":{"Change":16386,"EditOwn":0,"ReadFullRecord":8193},"LogFile":{"Change":0,"EditOwn":0,"ReadFullRecord":24576},"JobOperations":{"Change":16384,"EditOwn":0,"ReadFullRecord":8195},"AyaNova7Import":{"Change":16384,"EditOwn":0,"ReadFullRecord":0},"Metrics":{"Change":0,"EditOwn":0,"ReadFullRecord":24576},"Locale":{"Change":16386,"EditOwn":0,"ReadFullRecord":32767},"DataFilter":{"Change":2,"EditOwn":32767,"ReadFullRecord":32767},"FormCustom":{"Change":2,"EditOwn":0,"ReadFullRecord":32767}}' ); - var typeName = _.findKey(this.AYATYPE, function(o) { + + + var typeName = _.findKey(vm.$gztype, function(o) { return o == oType; }); - -var theRight=AYANOVA_RIGHTS[typeName]; + + var theRight = AYANOVA_RIGHTS[typeName]; // var theType = _.find(this.AYATYPE, function(o) { // return o.value == oType; // }); diff --git a/ayanova/src/main.js b/ayanova/src/main.js index a0beddf5..e79fe577 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -20,6 +20,7 @@ import locale from "./api/locale"; import gzapi from "./api/gzapi"; import gzform from "./api/gzform"; import roles from "./api/authorizationroles"; +import gztype from "./api/ayatype"; import "@/assets/css/main.css"; import gzdateandtimepicker from "./components/gzdateandtimepicker.vue"; @@ -28,6 +29,7 @@ import gzdateandtimepicker from "./components/gzdateandtimepicker.vue"; // LIBS AND GLOBAL ITEMS // (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8) // +Object.defineProperty(Vue.prototype, "$gztype", { value: gztype }); Object.defineProperty(Vue.prototype, "$gzrole", { value: roles }); Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus }); Object.defineProperty(Vue.prototype, "$gzmenu", { value: gzmenu }); diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 8f525b42..da35cc0a 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -372,8 +372,9 @@ export default { }, duplicate() { this.$gzrole.rights( + this, this.$store.state.roles, - this.$gzrole.AYATYPE.Widget, + this.$gztype.Widget, this.$store.state.userId ); //only if not dirty