This commit is contained in:
2019-06-05 00:02:53 +00:00
parent 9427fd1a8a
commit f4d9220d62
9 changed files with 195 additions and 88 deletions

View File

@@ -1,9 +1,9 @@
/* eslint-disable */
/* xeslint-disable */
import _ from "../libs/lodash.min.js";
import store from "../store";
import rights from "./bizroles";
export default {
export default {
ROLE_RIGHTS: rights,
AUTHORIZATION_ROLES: {
///<summary>No role set</summary>
@@ -48,8 +48,7 @@ export default {
/////////////////////////////////
//
//
getRights(vm, oType) {
getRights(vm, oType) {
//from bizroles.cs:
//HOW THIS WORKS / WHATS EXPECTED
//Change = CREATE, RETRIEVE, UPDATE, DELETE - Full rights
@@ -72,24 +71,23 @@ export default {
//Get the AyaNova stock role rights for that object
var objectRoleRights = this.ROLE_RIGHTS[typeName];
//get the logged in user's role
var userRole = vm.$store.state.roles;
//calculate the effective rights
//calculate the effective rights
//a non zero result of the bitwise calculation means true and zero means false so using !! to force it into a boolean value (contrary to some style guides that say !! is obscure but I say it saves a lot of typing)
var canChange = !!(userRole & objectRoleRights.Change);
var canChange = !!(userRole & objectRoleRights.Change);
var canReadFullRecord = !!(userRole & objectRoleRights.ReadFullRecord);
ret.change=canChange;
ret.delete=ret.change;//FOR NOW
ret.read=canReadFullRecord;
ret.change = canChange;
ret.delete = ret.change; //FOR NOW
ret.read = canReadFullRecord;
return ret;
}
};
/*
/*
USING BITWISE OPERATORS CHEAT SHEET
//https://codeburst.io/using-javascript-bitwise-operators-in-real-life-f551a731ff5
// Test whether your bit number has a single attribute. '&' ensures
@@ -127,4 +125,4 @@ if (myBitNumber == (myBitNumber | (HAS_FOO2 | HAS_FOO4))) {
if (myBitNumber == (myBitNumber | (HAS_FOO2 | HAS_FOO3 | HAS_FOO4))) {
// False
}
*/
*/

View File

@@ -1,4 +1,4 @@
/* Xeslint-disable */
/* xeslint-disable */
///////////////////////////////
// gzform
//
@@ -11,6 +11,7 @@
// Add any new keys used to the block in locale.js=>commonKeysEditForm
import Vue from "vue";
import errorHandler from "./errorhandler";
import store from "../store";
var triggeringChange = false;
@@ -436,8 +437,8 @@ export default {
// This is required so that server errors can be cleared when input is changed
//
onChange(vm, ref) {
//eslint-disable-next-line
console.log("GZFORM::onChange triggered!");
//xeslint-disable-next-line
//console.log("GZFORM::onChange triggered!");
if (triggeringChange || vm.formState.loading) {
return;
}
@@ -505,5 +506,23 @@ export default {
newState.vm.formState.readOnly = newState.readOnly;
}
});
},
////////////////////////////////////
// Get form settings
// for form specified or empty object if there is none
// EAch form is responsible for what it stores and how it initializes, this just provides that
// the form does the actual work of what settings it requires
//
getFormSettings(formKey) {
var theFormSettings = store.state.formSettings[formKey];
return theFormSettings;
},
////////////////////////////////////
// Set form settings
// for form key specified
//
//
setFormSettings(formKey, formSettings) {
store.commit("setFormSettings", formKey, formSettings);
}
};

View File

@@ -62,7 +62,7 @@ export default {
if (!result) {
const isMac = navigator.platform.toUpperCase().indexOf("MAC") >= 0;
const copyHotkey = isMac ? "⌘C" : "CTRL+C";
result = prompt(`Press ${copyHotkey}`, string); // eslint-disable-line no-alert
result = prompt(`Press ${copyHotkey}`, string);
if (!result) {
return false;
}