case 4232
This commit is contained in:
@@ -182,33 +182,53 @@ export default {
|
|||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
canAdd: function() {
|
canAdd: function() {
|
||||||
//first check most obvious disqualifying properties
|
//first check most obvious disqualifying property which is that user is not allowed to change at all
|
||||||
if (!this.pvm.rights.change) {
|
if (!this.pvm.rights.change) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//not currently locked, user has rights to do it so allow it
|
//FACT: isLockedAtServer is *only* set when the status is a locking status, no other time, it's poorly named
|
||||||
if (!this.value.isLockedAtServer) {
|
//and should be isSetToALockedStatus but here we are, it's post release, can't change it now
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//locked, confirm if user can change it
|
//for purposes of making changes here it doesn't really matter if it's locked status or not, all that needs to be known is
|
||||||
//if any role then no problem
|
//can the user remove this status
|
||||||
|
|
||||||
//ok, only thing left to check is if the current user can unlock this
|
|
||||||
//get remove roles required for current state
|
|
||||||
const cs = this.pvm.currentState;
|
const cs = this.pvm.currentState;
|
||||||
if (cs.removeRoles == null || cs.removeRoles == 0) {
|
|
||||||
//no state set yet
|
if (cs == null || cs.removeRoles == null || cs.removeRoles == 0) {
|
||||||
|
//no state set yet or no remove roles set so nothing to check against
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ok, need to check the role here against current user roles to see if this is valid
|
//We have a state set already, need to check the role here against current user roles to see if this user is allowed to add a state
|
||||||
if (window.$gz.role.hasRole(cs.removeRoles)) {
|
if (window.$gz.role.hasRole(cs.removeRoles)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//it's locked and there seems to be no reason to allow a change so no
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// //not currently locked, user has rights to do it so allow it
|
||||||
|
// if (!this.value.isLockedAtServer) {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //locked, confirm if user can change it
|
||||||
|
// //if any role then no problem
|
||||||
|
|
||||||
|
// //ok, only thing left to check is if the current user can unlock this
|
||||||
|
// //get remove roles required for current state
|
||||||
|
// const cs = this.pvm.currentState;
|
||||||
|
// if (cs.removeRoles == null || cs.removeRoles == 0) {
|
||||||
|
// //no state set yet
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //ok, need to check the role here against current user roles to see if this is valid
|
||||||
|
// if (window.$gz.role.hasRole(cs.removeRoles)) {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return false;
|
||||||
},
|
},
|
||||||
allErrors: function() {
|
allErrors: function() {
|
||||||
let ret = "";
|
let ret = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user