Renamed roles and trans keys "Limited"->"Restricted" "Full" -> ""

This commit is contained in:
2021-07-12 17:29:42 +00:00
parent 1994691749
commit 5cbc6516e1
13 changed files with 122 additions and 122 deletions

View File

@@ -70,9 +70,9 @@ EDGE desktop
- Rights work properly - Rights work properly
- Test as manager - Test as manager
- Test widget form under full, edit own and readonly and no rights, confirm it works - Test widget form under full, edit own and readonly and no rights, confirm it works
- Roles: Change = AuthorizationRoles.BizAdminFull | AuthorizationRoles.InventoryFull, EditOwn = AuthorizationRoles.TechFull, ReadFullRecord = AuthorizationRoles.BizAdminLimited | AuthorizationRoles.InventoryLimited - Roles: Change = AuthorizationRoles.BizAdmin | AuthorizationRoles.Inventory, EditOwn = AuthorizationRoles.Tech, ReadRecord = AuthorizationRoles.BizAdminRestricted | AuthorizationRoles.InventoryRestricted
- 401 redirect to login - 401 redirect to login
- 403 should redirect to prior form (no rights SubContractorLimited) - 403 should redirect to prior form (no rights SubContractorRestricted)

View File

@@ -7,40 +7,40 @@ export default {
AUTHORIZATION_ROLES: { AUTHORIZATION_ROLES: {
///<summary>No role set</summary> ///<summary>No role set</summary>
NoRole: 0, NoRole: 0,
///<summary>BizAdminLimited</summary> ///<summary>BizAdminRestricted</summary>
BizAdminLimited: 1, BizAdminRestricted: 1,
///<summary>BizAdminFull</summary> ///<summary>BizAdmin</summary>
BizAdminFull: 2, BizAdmin: 2,
///<summary>ServiceLimited</summary> ///<summary>ServiceRestricted</summary>
ServiceLimited: 4, ServiceRestricted: 4,
///<summary>ServiceFull</summary> ///<summary>Service</summary>
ServiceFull: 8, Service: 8,
///<summary>InventoryLimited</summary> ///<summary>InventoryRestricted</summary>
InventoryLimited: 16, InventoryRestricted: 16,
///<summary>InventoryFull</summary> ///<summary>Inventory</summary>
InventoryFull: 32, Inventory: 32,
///<summary>AccountingFull</summary> ///<summary>Accounting</summary>
AccountingFull: 64, //No limited role, not sure if there is a need Accounting: 64, //No restricted role, not sure if there is a need
///<summary>TechLimited</summary> ///<summary>TechRestricted</summary>
TechLimited: 128, TechRestricted: 128,
///<summary>TechFull</summary> ///<summary>Tech</summary>
TechFull: 256, Tech: 256,
///<summary>SubContractorLimited</summary> ///<summary>SubContractorRestricted</summary>
SubContractorLimited: 512, SubContractorRestricted: 512,
///<summary>SubContractorFull</summary> ///<summary>SubContractor</summary>
SubContractorFull: 1024, SubContractor: 1024,
///<summary>CustomerLimited</summary> ///<summary>CustomerRestricted</summary>
CustomerLimited: 2048, CustomerRestricted: 2048,
///<summary>CustomerFull</summary> ///<summary>Customer</summary>
CustomerFull: 4096, Customer: 4096,
///<summary>OpsAdminLimited</summary> ///<summary>OpsAdminRestricted</summary>
OpsAdminLimited: 8192, OpsAdminRestricted: 8192,
///<summary>OpsAdminFull</summary> ///<summary>OpsAdmin</summary>
OpsAdminFull: 16384, OpsAdmin: 16384,
///<summary>SalesFull</summary> ///<summary>Sales</summary>
SalesFull: 32768, Sales: 32768,
///<summary>SalesLimited</summary> ///<summary>SalesRestricted</summary>
SalesLimited: 65536 SalesRestricted: 65536
}, },
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// Does current logged in user have role? // Does current logged in user have role?

View File

@@ -5,10 +5,10 @@ export default {
{ {
id: "TestListWidgetsPriciest", id: "TestListWidgetsPriciest",
roles: [ roles: [
role.BizAdminFull, role.BizAdmin,
role.BizAdminLimited, role.BizAdminRestricted,
role.SalesFull, role.Sales,
role.SalesLimited role.SalesRestricted
], ],
title: "Priciest widgets (all time) ", title: "Priciest widgets (all time) ",
type: "GzDashTestListWidgetsPriciest" type: "GzDashTestListWidgetsPriciest"
@@ -16,10 +16,10 @@ export default {
{ {
id: "TestBarWidgetCountByUserType", id: "TestBarWidgetCountByUserType",
roles: [ roles: [
role.BizAdminFull, role.BizAdmin,
role.BizAdminLimited, role.BizAdminRestricted,
role.SalesFull, role.Sales,
role.SalesLimited role.SalesRestricted
], ],
title: "Widgets by User type", title: "Widgets by User type",
type: "GzDashTestBarWidgetCountByUserType" type: "GzDashTestBarWidgetCountByUserType"
@@ -27,10 +27,10 @@ export default {
{ {
id: "TestLineWidgetMonthlyTotalPrice", id: "TestLineWidgetMonthlyTotalPrice",
roles: [ roles: [
role.BizAdminFull, role.BizAdmin,
role.BizAdminLimited, role.BizAdminRestricted,
role.SalesFull, role.Sales,
role.SalesLimited role.SalesRestricted
], ],
title: "Widget monthly total", title: "Widget monthly total",
type: "GzDashTestLineWidgetMonthlyTotalPrice" type: "GzDashTestLineWidgetMonthlyTotalPrice"
@@ -38,10 +38,10 @@ export default {
{ {
id: "TestDayCalendarWidget", id: "TestDayCalendarWidget",
roles: [ roles: [
role.BizAdminFull, role.BizAdmin,
role.BizAdminLimited, role.BizAdminRestricted,
role.SalesFull, role.Sales,
role.SalesLimited role.SalesRestricted
], ],
title: "WO calendar", title: "WO calendar",
type: "GzDashTestDayCalendarWidget" type: "GzDashTestDayCalendarWidget"

View File

@@ -168,11 +168,11 @@ export default {
ctx.formData && ctx.formData &&
ctx.formData.formCustomTemplateKey != undefined && ctx.formData.formCustomTemplateKey != undefined &&
window.$gz.role.hasRole([ window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, window.$gz.role.AUTHORIZATION_ROLES.BizAdminRestricted,
window.$gz.role.AUTHORIZATION_ROLES.BizAdminLimited window.$gz.role.AUTHORIZATION_ROLES.BizAdminRestricted
]) ])
) { ) {
//NOTE: BizAdminFull can edit, bizadminlimited can read only //NOTE: BizAdmin can edit, BizAdminRestricted can read only
//add customize menu item //add customize menu item
//DIVIDER //DIVIDER
//Insert the devider between context and global items //Insert the devider between context and global items

View File

@@ -26,7 +26,7 @@ export default {
this.availableRoles = rawRoles; this.availableRoles = rawRoles;
} else { } else {
if (this.limitSelectionTo == "inside") { if (this.limitSelectionTo == "inside") {
//CustomerLimited=2048, CustomerFull=4096 //CustomerRestricted=2048, Customer=4096
this.availableRoles = rawRoles.filter( this.availableRoles = rawRoles.filter(
z => z.id != 2048 && z.id != 4096 z => z.id != 2048 && z.id != 4096
); );

View File

@@ -37,7 +37,7 @@ export default new Vuex.Store({
userType: 0, userType: 0,
homePage: undefined, homePage: undefined,
translationText: {}, translationText: {},
enums: {}, //all enum values with translated text to match stored as key e.g. enums:={AuthorizationRoles:{0:"no role",1:"Limited role"},UserTypes:{0:"Technician",1:"Client user"}} enums: {}, //all enum values with translated text to match stored as key
userOptions: { userOptions: {
languageOverride: "en-US", languageOverride: "en-US",
timeZoneOverride: null, //use browser tz by default timeZoneOverride: null, //use browser tz by default
@@ -147,7 +147,7 @@ export default new Vuex.Store({
state.globalSettings = data; state.globalSettings = data;
}, },
setEnum(state, data) { setEnum(state, data) {
state.enums[data.enumKey] = data.items; //{enumKey:"AuthorizationRoles",items:[{0:"no role"},{1:"Limited role"}]} state.enums[data.enumKey] = data.items; //{enumKey:"AuthorizationRoles",items:[{0:"no role"},{1:"Restricted role"}]}
}, },
setAPIURL(state, data) { setAPIURL(state, data) {
state.apiUrl = data; state.apiUrl = data;

View File

@@ -48,7 +48,7 @@
const FORM_KEY = "adm-import"; const FORM_KEY = "adm-import";
export default { export default {
async created() { async created() {
//NOTE: chose this because there is no general import but report covers bizadminfull and bizadminlimited //NOTE: chose this because there is no general import but report covers bizadmin and bizadminrestricted
this.rights = window.$gz.role.getRights(window.$gz.type.Report); this.rights = window.$gz.role.getRights(window.$gz.type.Report);
window.$gz.eventBus.$on("menu-click", clickHandler); window.$gz.eventBus.$on("menu-click", clickHandler);
await fetchTranslatedText(this); await fetchTranslatedText(this);

View File

@@ -298,11 +298,11 @@ export default {
rights: window.$gz.role.defaultRightsObject(), rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.Review, ayaType: window.$gz.type.Review,
currentUserIsASupervisor: window.$gz.role.hasRole([ currentUserIsASupervisor: window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, window.$gz.role.AUTHORIZATION_ROLES.BizAdmin,
window.$gz.role.AUTHORIZATION_ROLES.ServiceFull, window.$gz.role.AUTHORIZATION_ROLES.Service,
window.$gz.role.AUTHORIZATION_ROLES.InventoryFull, window.$gz.role.AUTHORIZATION_ROLES.Inventory,
window.$gz.role.AUTHORIZATION_ROLES.SalesFull, window.$gz.role.AUTHORIZATION_ROLES.Sales,
window.$gz.role.AUTHORIZATION_ROLES.AccountingFull window.$gz.role.AUTHORIZATION_ROLES.Accounting
]), ]),
name: null name: null
}; };
@@ -352,18 +352,18 @@ export default {
hasSupervisorRole: function() { hasSupervisorRole: function() {
//mirrored from ReviewBiz.cs validation rule at server //mirrored from ReviewBiz.cs validation rule at server
/* /*
CurrentUserRoles.HasFlag(AuthorizationRoles.BizAdminFull) || CurrentUserRoles.HasFlag(AuthorizationRoles.BizAdmin) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.ServiceFull) || CurrentUserRoles.HasFlag(AuthorizationRoles.Service) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.InventoryFull) || CurrentUserRoles.HasFlag(AuthorizationRoles.Inventory) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.SalesFull) || CurrentUserRoles.HasFlag(AuthorizationRoles.Sales) ||
CurrentUserRoles.HasFlag(AuthorizationRoles.AccountingFull); CurrentUserRoles.HasFlag(AuthorizationRoles.Accounting);
*/ */
return window.$gz.role.hasRole([ return window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull, window.$gz.role.AUTHORIZATION_ROLES.BizAdmin,
window.$gz.role.AUTHORIZATION_ROLES.ServiceFull, window.$gz.role.AUTHORIZATION_ROLES.Service,
window.$gz.role.AUTHORIZATION_ROLES.InventoryFull, window.$gz.role.AUTHORIZATION_ROLES.Inventory,
window.$gz.role.AUTHORIZATION_ROLES.SalesFull, window.$gz.role.AUTHORIZATION_ROLES.Sales,
window.$gz.role.AUTHORIZATION_ROLES.AccountingFull window.$gz.role.AUTHORIZATION_ROLES.Accounting
]); ]);
} }
}, },

View File

@@ -998,7 +998,7 @@ export default {
}, },
rights: window.$gz.role.defaultRightsObject(), rights: window.$gz.role.defaultRightsObject(),
canEditSerial: window.$gz.role.hasRole([ canEditSerial: window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.BizAdminFull window.$gz.role.AUTHORIZATION_ROLES.BizAdmin
]), ]),
ayaType: window.$gz.type.PurchaseOrder, ayaType: window.$gz.type.PurchaseOrder,
currencyName: window.$gz.locale.getCurrencyName(), currencyName: window.$gz.locale.getCurrencyName(),

View File

@@ -267,33 +267,33 @@ export default {
}, },
{ {
name: "Business admin", name: "Business admin",
l: "BizAdminFull", l: "BizAdmin",
p: "BizAdminFull" p: "BizAdmin"
}, },
{ {
name: "Business admin - limited", name: "Business admin - restricted",
l: "BizAdminLimited", l: "BizAdminRestricted",
p: "BizAdminLimited" p: "BizAdminRestricted"
}, },
{ {
name: "Customer", name: "Customer",
l: "CustomerFull", l: "Customer",
p: "CustomerFull" p: "Customer"
}, },
{ {
name: "Customer - limited", name: "Customer - restricted",
l: "CustomerLimited", l: "CustomerRestricted",
p: "CustomerLimited" p: "CustomerRestricted"
}, },
{ {
name: "Service", name: "Service",
l: "ServiceFull", l: "Service",
p: "ServiceFull" p: "Service"
}, },
{ {
name: "Service - limited", name: "Service - restricted",
l: "ServiceLimited", l: "ServiceRestricted",
p: "ServiceLimited" p: "ServiceRestricted"
}, },
{ {
name: "Head office", name: "Head office",
@@ -302,53 +302,53 @@ export default {
}, },
{ {
name: "Inventory", name: "Inventory",
l: "InventoryFull", l: "Inventory",
p: "InventoryFull" p: "Inventory"
}, },
{ {
name: "Inventory - limited", name: "Inventory - restricted",
l: "InventoryLimited", l: "InventoryRestricted",
p: "InventoryLimited" p: "InventoryRestricted"
}, },
{ {
name: "Operations", name: "Operations",
l: "OpsAdminFull", l: "OpsAdmin",
p: "OpsAdminFull" p: "OpsAdmin"
}, },
{ {
name: "Operations - limited", name: "Operations - restricted",
l: "OpsAdminLimited", l: "OpsAdminRestricted",
p: "OpsAdminLimited" p: "OpsAdminRestricted"
}, },
{ {
name: "Sales", name: "Sales",
l: "SalesFull", l: "Sales",
p: "SalesFull" p: "Sales"
}, },
{ {
name: "Sales - limited", name: "Sales - restricted",
l: "SalesLimited", l: "SalesRestricted",
p: "SalesLimited" p: "SalesRestricted"
}, },
{ {
name: "Subcontractor", name: "Subcontractor",
l: "SubContractorFull", l: "SubContractor",
p: "SubContractorFull" p: "SubContractor"
}, },
{ {
name: "Subcontractor - limited", name: "Subcontractor - restricted",
l: "SubContractorLimited", l: "SubContractorRestricted",
p: "SubContractorLimited" p: "SubContractorRestricted"
}, },
{ {
name: "Technician", name: "Technician",
l: "TechFull", l: "Tech",
p: "TechFull" p: "Tech"
}, },
{ {
name: "Technician - limited", name: "Technician - restricted",
l: "TechLimited", l: "TechRestricted",
p: "TechLimited" p: "TechRestricted"
}, },
{ {
name: "Translation - Deutsch / German", name: "Translation - Deutsch / German",

View File

@@ -4,12 +4,12 @@ describe("GZ-DATA-TABLE", () => {
cy.get("input[name=username]") cy.get("input[name=username]")
.clear() .clear()
.type("BizAdminFull"); .type("BizAdmin");
// {enter} causes the form to submit // {enter} causes the form to submit
cy.get("input[name=password]") cy.get("input[name=password]")
.clear() .clear()
.type("BizAdminFull{enter}"); .type("BizAdmin{enter}");
//cy.url().should("include", "/home-dashboard"); //cy.url().should("include", "/home-dashboard");
cy.visit("/widgets"); cy.visit("/widgets");
cy.url().should("include", "/widgets"); cy.url().should("include", "/widgets");

View File

@@ -453,10 +453,10 @@ describe("SMOKE", () => {
//CUSTOMER PAGES //CUSTOMER PAGES
cy.get("input[name=username]") cy.get("input[name=username]")
.clear() .clear()
.type("CustomerFull"); .type("Customer");
cy.get("input[name=password]") cy.get("input[name=password]")
.clear() .clear()
.type("CustomerFull{enter}"); .type("Customer{enter}");
cy.url({ timeout: 10000 }).should("include", "/customer-csr"); cy.url({ timeout: 10000 }).should("include", "/customer-csr");
cy.get("[data-cy=underconstruction]"); cy.get("[data-cy=underconstruction]");

View File

@@ -95,15 +95,15 @@ describe("TRANSLATION", () => {
cy.url().should("include", "/login"); cy.url().should("include", "/login");
//----------------------------------------------------- //-----------------------------------------------------
//ENGLISH - CustomerLimited //ENGLISH - CustomerRestricted
cy.get("input[name=username]") cy.get("input[name=username]")
.clear() .clear()
.type("CustomerLimited"); .type("CustomerRestricted");
// {enter} causes the form to submit // {enter} causes the form to submit
cy.get("input[name=password]") cy.get("input[name=password]")
.clear() .clear()
.type("CustomerLimited{enter}"); .type("CustomerRestricted{enter}");
// we should be redirected to /customer-csr // we should be redirected to /customer-csr
cy.url().should("include", "/customer-csr"); cy.url().should("include", "/customer-csr");