This commit is contained in:
@@ -51,7 +51,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
//array form?
|
||||
if (window.$gz._.isArray(desiredRole)) {
|
||||
if (Array.isArray(desiredRole)) {
|
||||
//it's an array of roles, iterate and if any are present then return true
|
||||
for (let i = 0; i < desiredRole.length; i++) {
|
||||
if ((window.$gz.store.state.roles & desiredRole[i]) != 0) {
|
||||
@@ -101,9 +101,19 @@ export default {
|
||||
let ret = this.defaultRightsObject();
|
||||
|
||||
//Get the type name from the type enum value
|
||||
let typeName = window.$gz._.findKey(window.$gz.type, function(o) {
|
||||
return o == oType;
|
||||
});
|
||||
//de-lodash
|
||||
// let typeName = window.$gz. _.findKey(window.$gz.type, function(o) {
|
||||
// return o == oType;
|
||||
// });
|
||||
|
||||
//my _.findKey replacement:
|
||||
let typeName = undefined;
|
||||
for (const [key, value] of Object.entries(window.$gz.type)) {
|
||||
if (value == oType) {
|
||||
typeName = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Get the AyaNova stock REQUIRED role rights for that object
|
||||
let objectRoleRights = this.ROLE_RIGHTS[typeName];
|
||||
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
// Used by forms to fetch selection list data
|
||||
// Sorts alphabetically by default but can be turned off with do not sort
|
||||
//
|
||||
getSelectionList(enumKey, doNotSort) {
|
||||
getSelectionList(enumKey) {
|
||||
enumKey = enumKey.toLowerCase();
|
||||
let e = window.$gz.store.state.enums[enumKey];
|
||||
if (!e) {
|
||||
@@ -41,16 +41,24 @@ export default {
|
||||
);
|
||||
}
|
||||
let ret = [];
|
||||
//turn it into an array suitable for selection lists
|
||||
window.$gz._.forOwn(e, function(value, key) {
|
||||
ret.push({ id: Number(key), name: value });
|
||||
});
|
||||
|
||||
if (doNotSort == true) {
|
||||
return ret;
|
||||
} else {
|
||||
return window.$gz._.sortBy(ret, "name");
|
||||
//de-lodash
|
||||
// //turn it into an array suitable for selection lists
|
||||
// window.$gz._.forOwn(e, function(value, key) {
|
||||
// ret.push({ id: Number(key), name: value });
|
||||
// });
|
||||
|
||||
//turn it into an array suitable for selection lists
|
||||
for (const [key, value] of Object.entries(e)) {
|
||||
ret.push({ id: Number(key), name: value });
|
||||
}
|
||||
|
||||
//e is an object with keys of id values i.e. {1:"display1",2:"display 2"}
|
||||
//what needs to be returned is an array of objects like: [{id:1,name:"display1"},{id:2,name:"display2"}]
|
||||
|
||||
console.log("enum::getSelectionList, e is: ", e);
|
||||
console.log("ret is", ret);
|
||||
return window.$gz._.sortBy(ret, "name");
|
||||
},
|
||||
///////////////////////////////////
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user