This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
import store from "../store";
|
||||
|
||||
export default {
|
||||
version: "8.0.0-alpha.5",
|
||||
copyright:
|
||||
"Copyright © 1999-2019, Ground Zero Tech-Works Inc. All Rights Reserved"
|
||||
"Copyright © 1999-2019, Ground Zero Tech-Works Inc. All Rights Reserved",
|
||||
userName: store.state.userName,
|
||||
browser: {
|
||||
platform: window.navigator.platform,
|
||||
userAgent: window.navigator.userAgent,
|
||||
language: window.navigator.language,
|
||||
oscpu: window.navigator.oscpu,
|
||||
maxTouchPoints: window.navigator.maxTouchPoints,
|
||||
webdriver: window.navigator.webdriver,
|
||||
vendor: window.navigator.vendor,
|
||||
availWidth: window.screen.availWidth,
|
||||
availHeight: window.screen.availHeight,
|
||||
width: window.screen.width,
|
||||
height: window.screen.height,
|
||||
devicePixelRatio: window.devicePixelRatio,
|
||||
pixelDepth: window.screen.pixelDepth
|
||||
}
|
||||
};
|
||||
TODO: SHOw this shit
|
||||
@@ -48,15 +48,16 @@ export default {
|
||||
/////////////////////////////////
|
||||
//
|
||||
//
|
||||
getRights(vm, oType, ownerId) {
|
||||
getRights(vm, oType) {
|
||||
|
||||
//from bizroles.cs:
|
||||
//HOW THIS WORKS / WHATS EXPECTED
|
||||
//Change = CREATE, RETRIEVE, UPDATE, DELETE - Full rights
|
||||
//EditOwn = special subset of CHANGE: You can create and if it's one you created then you have rights to edit it or delete, but you can't edit ones others have created
|
||||
//
|
||||
//ReadFullRecord = You can read *all* the fields of the record, but can't modify it. Change is automatically checked for so only add different roles from change
|
||||
//PICKLIST NOTE: this does not control getting a list of names for selection which is role independent because it's required for so much indirectly
|
||||
//DELETE = SAME AS CHANGE FOR NOW (There is no specific delete right for now though it's checked for by routes in Authorized.cs in case we want to add it in future as a separate right from create.)
|
||||
//NOTE: biz rules can supersede this, this is just for general rights purposes, if an object has restrictive business rules they will take precedence every time.
|
||||
|
||||
var ret = {
|
||||
change: false,
|
||||
@@ -71,18 +72,17 @@ 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;
|
||||
//see if it's self owned
|
||||
var isSelfOwned = ownerId == vm.$store.state.userId;
|
||||
|
||||
|
||||
//calculate the effective rights taking into consideration self owned etc
|
||||
//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 canEditOwn = isSelfOwned && (!!(userRole & objectRoleRights.EditOwn));
|
||||
var canChange = !!(userRole & objectRoleRights.Change);
|
||||
var canReadFullRecord = !!(userRole & objectRoleRights.ReadFullRecord);
|
||||
|
||||
ret.change=canChange || canEditOwn;
|
||||
ret.change=canChange;
|
||||
ret.delete=ret.change;//FOR NOW
|
||||
ret.read=canReadFullRecord;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ export function processLogin(response) {
|
||||
apiToken: response.data.token,
|
||||
authenticated: true,
|
||||
userId: Number(token.id),
|
||||
userName: token.name,
|
||||
roles: token["ayanova/roles"]
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var rights = JSON.parse(
|
||||
//TODO CACHE THIS??
|
||||
'{"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}}'
|
||||
'{"User":{"Change":2,"ReadFullRecord":1},"UserOptions":{"Change":2,"ReadFullRecord":1},"Widget":{"Change":34,"ReadFullRecord":17},"ServerState":{"Change":16384,"ReadFullRecord":32767},"License":{"Change":16386,"ReadFullRecord":8193},"LogFile":{"Change":0,"ReadFullRecord":24576},"JobOperations":{"Change":16384,"ReadFullRecord":8195},"AyaNova7Import":{"Change":16384,"ReadFullRecord":0},"Metrics":{"Change":0,"ReadFullRecord":24576},"Locale":{"Change":16386,"ReadFullRecord":32767},"DataFilter":{"Change":2,"ReadFullRecord":32767},"FormCustom":{"Change":2,"ReadFullRecord":32767}}'
|
||||
);
|
||||
export default rights;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user