From 02c30441bcd2fdfb23a230e2158d28e1aae97949 Mon Sep 17 00:00:00 2001 From: iLGunners Date: Thu, 18 Oct 2018 15:52:40 +0600 Subject: [PATCH 1/3] organization-selected --- client/src/page-add-employee.html | 2 +- client/src/page-add-products.html | 2 +- client/src/page-bulk-import-product-categories.html | 2 +- client/src/page-edit-customer.html | 2 +- client/src/page-edit-employee.html | 2 +- client/src/page-edit-outlet.html | 2 +- client/src/page-edit-product-category.html | 2 +- client/src/page-edit-product.html | 2 +- client/src/page-edit-sales-return.html | 2 +- client/src/page-edit-warehouse.html | 2 +- client/src/page-hire-employee.html | 2 +- client/src/page-manage-customers.html | 2 +- client/src/page-manage-employees.html | 2 +- client/src/page-manage-outlets.html | 2 +- client/src/page-manage-product-categories.html | 2 +- client/src/page-manage-sales-return.html | 2 +- client/src/page-manage-sales.html | 2 +- client/src/page-manage-warehouses.html | 2 +- client/src/page-pos-select-products.html | 2 +- client/src/page-pos.html | 2 +- client/src/page-print-sales-receipt.html | 2 +- client/src/page-report-inventories.html | 2 +- client/src/page-report-sales.html | 2 +- client/src/page-report-select-inventories.html | 2 +- client/src/page-view-customer.html | 2 +- client/src/page-view-employee.html | 2 +- client/src/page-view-inventory.html | 2 +- client/src/page-view-outlet.html | 2 +- client/src/page-view-sales-return.html | 2 +- client/src/page-view-sales.html | 2 +- client/src/page-view-warehouse.html | 2 +- client/src/page-withdraw-from-change-wallet-balance.html | 2 +- client/src/torque-page-behavior.html | 6 +++--- 33 files changed, 35 insertions(+), 35 deletions(-) diff --git a/client/src/page-add-employee.html b/client/src/page-add-employee.html index d11eb3bad..47218c5ad 100644 --- a/client/src/page-add-employee.html +++ b/client/src/page-add-employee.html @@ -117,7 +117,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_USERS']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_USERS']); } // region: createEmployee ================================= diff --git a/client/src/page-add-products.html b/client/src/page-add-products.html index e4cb4618c..0d531ea22 100644 --- a/client/src/page-add-products.html +++ b/client/src/page-add-products.html @@ -238,7 +238,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_ADD_PRODUCTS_TO_ALL_INVENTORIES']); + return this.accessControl('organization-selected', ['PRIV_ADD_PRODUCTS_TO_ALL_INVENTORIES']); } _fetchProductCategoryList(cbfn) { diff --git a/client/src/page-bulk-import-product-categories.html b/client/src/page-bulk-import-product-categories.html index 378ddce02..8aa6ed2da 100644 --- a/client/src/page-bulk-import-product-categories.html +++ b/client/src/page-bulk-import-product-categories.html @@ -247,7 +247,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); } // region: ui =========================== diff --git a/client/src/page-edit-customer.html b/client/src/page-edit-customer.html index 14601aa4e..fdcece900 100644 --- a/client/src/page-edit-customer.html +++ b/client/src/page-edit-customer.html @@ -118,7 +118,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_CUSTOMER']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_CUSTOMER']); } // region: editCustomer ================================= diff --git a/client/src/page-edit-employee.html b/client/src/page-edit-employee.html index 1ae94dd3a..053a8dd4d 100644 --- a/client/src/page-edit-employee.html +++ b/client/src/page-edit-employee.html @@ -112,7 +112,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_USERS']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_USERS']); } // region: editEmployee ================================= diff --git a/client/src/page-edit-outlet.html b/client/src/page-edit-outlet.html index b5ea5ae5f..acd778937 100644 --- a/client/src/page-edit-outlet.html +++ b/client/src/page-edit-outlet.html @@ -125,7 +125,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_ALL_OUTLETS']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_OUTLETS']); } // region: editOutlet ================================= diff --git a/client/src/page-edit-product-category.html b/client/src/page-edit-product-category.html index 192fddabf..2682a6506 100644 --- a/client/src/page-edit-product-category.html +++ b/client/src/page-edit-product-category.html @@ -173,7 +173,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); } // region: editProductCategory ================================= diff --git a/client/src/page-edit-product.html b/client/src/page-edit-product.html index ba8481035..f380f1a87 100644 --- a/client/src/page-edit-product.html +++ b/client/src/page-edit-product.html @@ -99,7 +99,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); } // region: editCustomer ================================= diff --git a/client/src/page-edit-sales-return.html b/client/src/page-edit-sales-return.html index e9d5eb3ab..dc66c11f4 100644 --- a/client/src/page-edit-sales-return.html +++ b/client/src/page-edit-sales-return.html @@ -128,7 +128,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_SALES_RETURN']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_SALES_RETURN']); } _fetchSales(cbfn) { diff --git a/client/src/page-edit-warehouse.html b/client/src/page-edit-warehouse.html index 7a06f3c7f..c2a982051 100644 --- a/client/src/page-edit-warehouse.html +++ b/client/src/page-edit-warehouse.html @@ -123,7 +123,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_ALL_WAREHOUSES']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_WAREHOUSES']); } // region: editWarehouse ================================= diff --git a/client/src/page-hire-employee.html b/client/src/page-hire-employee.html index fd2c60619..919d5b542 100644 --- a/client/src/page-hire-employee.html +++ b/client/src/page-hire-employee.html @@ -126,7 +126,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MODIFY_USERS']); + return this.accessControl('organization-selected', ['PRIV_MODIFY_USERS']); } // region: proces ================================= diff --git a/client/src/page-manage-customers.html b/client/src/page-manage-customers.html index 352c7451e..a0dfd0b87 100644 --- a/client/src/page-manage-customers.html +++ b/client/src/page-manage-customers.html @@ -146,7 +146,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_CUSTOMER']); + return this.accessControl('organization-selected', ['PRIV_VIEW_CUSTOMER']); } _fetchCustomerList(cbfn) { diff --git a/client/src/page-manage-employees.html b/client/src/page-manage-employees.html index 668088db9..d9c3f98ca 100644 --- a/client/src/page-manage-employees.html +++ b/client/src/page-manage-employees.html @@ -118,7 +118,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_USERS']); + return this.accessControl('organization-selected', ['PRIV_VIEW_USERS']); } _fetchEmployeeList(cbfn) { diff --git a/client/src/page-manage-outlets.html b/client/src/page-manage-outlets.html index 95007f90d..ccea9d4e7 100644 --- a/client/src/page-manage-outlets.html +++ b/client/src/page-manage-outlets.html @@ -115,7 +115,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_OUTLETS']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_OUTLETS']); } _fetchOutletList(cbfn) { diff --git a/client/src/page-manage-product-categories.html b/client/src/page-manage-product-categories.html index ec5d2921b..021ffa71a 100644 --- a/client/src/page-manage-product-categories.html +++ b/client/src/page-manage-product-categories.html @@ -202,7 +202,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); } _fetchProductCategoryList(cbfn) { diff --git a/client/src/page-manage-sales-return.html b/client/src/page-manage-sales-return.html index dbb547b7b..35024cf48 100644 --- a/client/src/page-manage-sales-return.html +++ b/client/src/page-manage-sales-return.html @@ -226,7 +226,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_SALES_RETURN']); + return this.accessControl('organization-selected', ['PRIV_VIEW_SALES_RETURN']); } _fetchSalesReturnList(cbfn) { diff --git a/client/src/page-manage-sales.html b/client/src/page-manage-sales.html index 43ed3142a..3047cda1b 100644 --- a/client/src/page-manage-sales.html +++ b/client/src/page-manage-sales.html @@ -255,7 +255,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_SALES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); } _fetchSalesList(cbfn) { diff --git a/client/src/page-manage-warehouses.html b/client/src/page-manage-warehouses.html index a3e687b48..ca7867d8e 100644 --- a/client/src/page-manage-warehouses.html +++ b/client/src/page-manage-warehouses.html @@ -114,7 +114,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_WAREHOUSES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_WAREHOUSES']); } _fetchWarehouseList(cbfn) { diff --git a/client/src/page-pos-select-products.html b/client/src/page-pos-select-products.html index ecda5c60d..94bfd0596 100644 --- a/client/src/page-pos-select-products.html +++ b/client/src/page-pos-select-products.html @@ -199,7 +199,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); } _fetchInventoryDetails(cbfn) { diff --git a/client/src/page-pos.html b/client/src/page-pos.html index 43f33f7ea..b82da04d4 100644 --- a/client/src/page-pos.html +++ b/client/src/page-pos.html @@ -368,7 +368,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_ACCESS_POS']); + return this.accessControl('organization-selected', ['PRIV_ACCESS_POS']); } // region: pos ================================= diff --git a/client/src/page-print-sales-receipt.html b/client/src/page-print-sales-receipt.html index 60c617383..ecfb47c81 100644 --- a/client/src/page-print-sales-receipt.html +++ b/client/src/page-print-sales-receipt.html @@ -325,7 +325,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_SALES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); } _printAndGoBack() { diff --git a/client/src/page-report-inventories.html b/client/src/page-report-inventories.html index fe23528ee..314ff1053 100644 --- a/client/src/page-report-inventories.html +++ b/client/src/page-report-inventories.html @@ -263,7 +263,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); } _fetchInventoriesData(cbfn) { diff --git a/client/src/page-report-sales.html b/client/src/page-report-sales.html index d04910f65..bc8a28e7b 100644 --- a/client/src/page-report-sales.html +++ b/client/src/page-report-sales.html @@ -333,7 +333,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_SALES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); } _fetchSalesList(cbfn) { diff --git a/client/src/page-report-select-inventories.html b/client/src/page-report-select-inventories.html index 705c10383..e7e7b67b4 100644 --- a/client/src/page-report-select-inventories.html +++ b/client/src/page-report-select-inventories.html @@ -142,7 +142,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); } _fetchInventoryList(cbfn) { diff --git a/client/src/page-view-customer.html b/client/src/page-view-customer.html index 06ac5fd73..b233ff6b3 100644 --- a/client/src/page-view-customer.html +++ b/client/src/page-view-customer.html @@ -135,7 +135,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_CUSTOMER']); + return this.accessControl('organization-selected', ['PRIV_VIEW_CUSTOMER']); } _fetchCustomer(cbfn) { diff --git a/client/src/page-view-employee.html b/client/src/page-view-employee.html index 0d66ae42b..f32f2c589 100644 --- a/client/src/page-view-employee.html +++ b/client/src/page-view-employee.html @@ -105,7 +105,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_USERS']); + return this.accessControl('organization-selected', ['PRIV_VIEW_USERS']); } _fetchEmployee(cbfn) { diff --git a/client/src/page-view-inventory.html b/client/src/page-view-inventory.html index 2d4417ad7..8f9e3b7ee 100644 --- a/client/src/page-view-inventory.html +++ b/client/src/page-view-inventory.html @@ -297,7 +297,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); } _fetchInventoryDetails(cbfn) { diff --git a/client/src/page-view-outlet.html b/client/src/page-view-outlet.html index 3bbd89ed6..a21473524 100644 --- a/client/src/page-view-outlet.html +++ b/client/src/page-view-outlet.html @@ -209,7 +209,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_OUTLETS']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_OUTLETS']); } _fetchOutlet(cbfn) { diff --git a/client/src/page-view-sales-return.html b/client/src/page-view-sales-return.html index 31e7955d2..77ca61eed 100644 --- a/client/src/page-view-sales-return.html +++ b/client/src/page-view-sales-return.html @@ -108,7 +108,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_SALES_RETURN']); + return this.accessControl('organization-selected', ['PRIV_VIEW_SALES_RETURN']); } _fetchSalesReturn(cbfn) { diff --git a/client/src/page-view-sales.html b/client/src/page-view-sales.html index f71ef0e7c..d6d30b1d5 100644 --- a/client/src/page-view-sales.html +++ b/client/src/page-view-sales.html @@ -193,7 +193,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_SALES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); } _fetchSales(cbfn) { diff --git a/client/src/page-view-warehouse.html b/client/src/page-view-warehouse.html index ce5006271..223ff4c49 100644 --- a/client/src/page-view-warehouse.html +++ b/client/src/page-view-warehouse.html @@ -124,7 +124,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_VIEW_ALL_WAREHOUSES']); + return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_WAREHOUSES']); } _fetchWarehouse(cbfn) { diff --git a/client/src/page-withdraw-from-change-wallet-balance.html b/client/src/page-withdraw-from-change-wallet-balance.html index 2406043e4..ea9f7adc1 100644 --- a/client/src/page-withdraw-from-change-wallet-balance.html +++ b/client/src/page-withdraw-from-change-wallet-balance.html @@ -110,7 +110,7 @@ } _ensureAccess() { - return this.accessControl('privileged', ['PRIV_MANAGE_CUSTOMER_WALLET_BALANCE']); + return this.accessControl('organization-selected', ['PRIV_MANAGE_CUSTOMER_WALLET_BALANCE']); } // region: editCustomer ================================= diff --git a/client/src/torque-page-behavior.html b/client/src/torque-page-behavior.html index b56827fad..abafac6b1 100644 --- a/client/src/torque-page-behavior.html +++ b/client/src/torque-page-behavior.html @@ -102,15 +102,15 @@ } accessControl(type, privilegeList = []) { - const typeList = ['special', 'authenticated', 'privileged']; + const typeList = ['special', 'authenticated', 'organization-selected']; if (typeList.indexOf(type) === -1) throw new Error("Invalid accessControl type."); - if (type === 'authenticated' || type === 'privileged') { + if (type === 'authenticated' || type === 'organization-selected') { if (!(this.app.user)) { this.app.navigateTo('/login'); return false; } } - if (type === 'privileged') { + if (type === 'organization-selected') { if (!this.app.organization) { this.app.navigateTo('/manage-organizations'); return false; From 0ea425a177edd2d2bc6be14e3a32c896e9a9991a Mon Sep 17 00:00:00 2001 From: iLGunners Date: Thu, 18 Oct 2018 15:55:09 +0600 Subject: [PATCH 2/3] accessControl({ authLevel, privilegeList = [] }) --- client/src/torque-page-behavior.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/torque-page-behavior.html b/client/src/torque-page-behavior.html index abafac6b1..905a7a59a 100644 --- a/client/src/torque-page-behavior.html +++ b/client/src/torque-page-behavior.html @@ -101,16 +101,16 @@ return this.app.organization.employment.privileges[privilege]; } - accessControl(type, privilegeList = []) { - const typeList = ['special', 'authenticated', 'organization-selected']; - if (typeList.indexOf(type) === -1) throw new Error("Invalid accessControl type."); - if (type === 'authenticated' || type === 'organization-selected') { + accessControl({ authLevel, privilegeList = [] }) { + const authLevelList = ['authenticated', 'organization-selected']; + if (authLevelList.indexOf(authLevel) === -1) throw new Error("Invalid accessControl authLevel."); + if (authLevel === 'authenticated' || authLevel === 'organization-selected') { if (!(this.app.user)) { this.app.navigateTo('/login'); return false; } } - if (type === 'organization-selected') { + if (authLevel === 'organization-selected') { if (!this.app.organization) { this.app.navigateTo('/manage-organizations'); return false; From c425389d5db2179325d7926c7a332e94fb7abc1d Mon Sep 17 00:00:00 2001 From: iLGunners Date: Thu, 18 Oct 2018 16:34:27 +0600 Subject: [PATCH 3/3] accessControl obj --- client/src/page-about.html | 4 +++- client/src/page-add-employee.html | 5 ++++- client/src/page-add-organization.html | 4 +++- client/src/page-add-products.html | 5 ++++- client/src/page-bulk-import-product-categories.html | 5 ++++- client/src/page-edit-customer.html | 5 ++++- client/src/page-edit-employee.html | 5 ++++- client/src/page-edit-outlet.html | 5 ++++- client/src/page-edit-product-category.html | 5 ++++- client/src/page-edit-product.html | 5 ++++- client/src/page-edit-profile.html | 6 ++++-- client/src/page-edit-sales-return.html | 5 ++++- client/src/page-edit-warehouse.html | 5 ++++- client/src/page-hire-employee.html | 5 ++++- client/src/page-home.html | 4 +++- client/src/page-manage-customers.html | 5 ++++- client/src/page-manage-employees.html | 7 +++++-- client/src/page-manage-organizations.html | 4 +++- client/src/page-manage-outlets.html | 5 ++++- client/src/page-manage-product-categories.html | 5 ++++- client/src/page-manage-sales-return.html | 5 ++++- client/src/page-manage-sales.html | 5 ++++- client/src/page-manage-warehouses.html | 5 ++++- client/src/page-payment.html | 4 +++- client/src/page-pos-select-products.html | 5 ++++- client/src/page-pos.html | 5 ++++- client/src/page-print-sales-receipt.html | 5 ++++- client/src/page-report-inventories.html | 5 ++++- client/src/page-report-sales.html | 5 ++++- client/src/page-report-select-inventories.html | 5 ++++- client/src/page-settings.html | 4 +++- client/src/page-view-customer.html | 5 ++++- client/src/page-view-employee.html | 5 ++++- client/src/page-view-inventory.html | 5 ++++- client/src/page-view-outlet.html | 5 ++++- client/src/page-view-sales-return.html | 5 ++++- client/src/page-view-sales.html | 5 ++++- client/src/page-view-warehouse.html | 5 ++++- client/src/page-withdraw-from-change-wallet-balance.html | 5 ++++- 39 files changed, 151 insertions(+), 41 deletions(-) diff --git a/client/src/page-about.html b/client/src/page-about.html index 29649957f..e833a0e7d 100644 --- a/client/src/page-about.html +++ b/client/src/page-about.html @@ -120,7 +120,9 @@ } _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } // region: misc ================================= diff --git a/client/src/page-add-employee.html b/client/src/page-add-employee.html index 47218c5ad..08e4f7834 100644 --- a/client/src/page-add-employee.html +++ b/client/src/page-add-employee.html @@ -117,7 +117,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_USERS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_USERS'] + }); } // region: createEmployee ================================= diff --git a/client/src/page-add-organization.html b/client/src/page-add-organization.html index 389776a01..2e547bc1e 100644 --- a/client/src/page-add-organization.html +++ b/client/src/page-add-organization.html @@ -106,7 +106,9 @@ } _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } // region: addOrganization ================================= diff --git a/client/src/page-add-products.html b/client/src/page-add-products.html index 0d531ea22..04251d307 100644 --- a/client/src/page-add-products.html +++ b/client/src/page-add-products.html @@ -238,7 +238,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_ADD_PRODUCTS_TO_ALL_INVENTORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_ADD_PRODUCTS_TO_ALL_INVENTORIES'] + }); } _fetchProductCategoryList(cbfn) { diff --git a/client/src/page-bulk-import-product-categories.html b/client/src/page-bulk-import-product-categories.html index 8aa6ed2da..0b71a4e8a 100644 --- a/client/src/page-bulk-import-product-categories.html +++ b/client/src/page-bulk-import-product-categories.html @@ -247,7 +247,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES'] + }); } // region: ui =========================== diff --git a/client/src/page-edit-customer.html b/client/src/page-edit-customer.html index fdcece900..0eaaf8319 100644 --- a/client/src/page-edit-customer.html +++ b/client/src/page-edit-customer.html @@ -118,7 +118,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_CUSTOMER']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_CUSTOMER'] + }); } // region: editCustomer ================================= diff --git a/client/src/page-edit-employee.html b/client/src/page-edit-employee.html index 053a8dd4d..e86a2f74e 100644 --- a/client/src/page-edit-employee.html +++ b/client/src/page-edit-employee.html @@ -112,7 +112,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_USERS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_USERS'] + }); } // region: editEmployee ================================= diff --git a/client/src/page-edit-outlet.html b/client/src/page-edit-outlet.html index acd778937..5d4adde98 100644 --- a/client/src/page-edit-outlet.html +++ b/client/src/page-edit-outlet.html @@ -125,7 +125,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_OUTLETS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_ALL_OUTLETS'] + }); } // region: editOutlet ================================= diff --git a/client/src/page-edit-product-category.html b/client/src/page-edit-product-category.html index 2682a6506..da430c62a 100644 --- a/client/src/page-edit-product-category.html +++ b/client/src/page-edit-product-category.html @@ -173,7 +173,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES'] + }); } // region: editProductCategory ================================= diff --git a/client/src/page-edit-product.html b/client/src/page-edit-product.html index f380f1a87..67c4b5bba 100644 --- a/client/src/page-edit-product.html +++ b/client/src/page-edit-product.html @@ -99,7 +99,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_ALL_PRODUCT_CATEGORIES'] + }); } // region: editCustomer ================================= diff --git a/client/src/page-edit-profile.html b/client/src/page-edit-profile.html index 2902a21a6..b20c2d454 100644 --- a/client/src/page-edit-profile.html +++ b/client/src/page-edit-profile.html @@ -132,9 +132,11 @@ this.removeAutoValidation('#changePasswordForm paper-input'); this.removeAutoValidation('#editProfileForm paper-input'); } - + _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } _processLoadProfile() { diff --git a/client/src/page-edit-sales-return.html b/client/src/page-edit-sales-return.html index dc66c11f4..fa6c2fe82 100644 --- a/client/src/page-edit-sales-return.html +++ b/client/src/page-edit-sales-return.html @@ -128,7 +128,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_SALES_RETURN']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_SALES_RETURN'] + }); } _fetchSales(cbfn) { diff --git a/client/src/page-edit-warehouse.html b/client/src/page-edit-warehouse.html index c2a982051..bd12821eb 100644 --- a/client/src/page-edit-warehouse.html +++ b/client/src/page-edit-warehouse.html @@ -123,7 +123,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_ALL_WAREHOUSES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_ALL_WAREHOUSES'] + }); } // region: editWarehouse ================================= diff --git a/client/src/page-hire-employee.html b/client/src/page-hire-employee.html index 919d5b542..072542d73 100644 --- a/client/src/page-hire-employee.html +++ b/client/src/page-hire-employee.html @@ -126,7 +126,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MODIFY_USERS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MODIFY_USERS'] + }); } // region: proces ================================= diff --git a/client/src/page-home.html b/client/src/page-home.html index ca718fbdc..55fecc7ce 100644 --- a/client/src/page-home.html +++ b/client/src/page-home.html @@ -243,7 +243,9 @@ } _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } _computeWarnings() { diff --git a/client/src/page-manage-customers.html b/client/src/page-manage-customers.html index a0dfd0b87..c14bd4274 100644 --- a/client/src/page-manage-customers.html +++ b/client/src/page-manage-customers.html @@ -146,7 +146,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_CUSTOMER']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_CUSTOMER'] + }); } _fetchCustomerList(cbfn) { diff --git a/client/src/page-manage-employees.html b/client/src/page-manage-employees.html index d9c3f98ca..3a08d85b9 100644 --- a/client/src/page-manage-employees.html +++ b/client/src/page-manage-employees.html @@ -116,9 +116,12 @@ super.onNavigateOut(); this.app.popPageTitle(); } - + _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_USERS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_USERS'] + }); } _fetchEmployeeList(cbfn) { diff --git a/client/src/page-manage-organizations.html b/client/src/page-manage-organizations.html index 74d9041ee..5fe3574fe 100644 --- a/client/src/page-manage-organizations.html +++ b/client/src/page-manage-organizations.html @@ -107,7 +107,9 @@ } _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } _fetchOrganizationList(cbfn) { diff --git a/client/src/page-manage-outlets.html b/client/src/page-manage-outlets.html index ccea9d4e7..c6d1cab67 100644 --- a/client/src/page-manage-outlets.html +++ b/client/src/page-manage-outlets.html @@ -115,7 +115,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_OUTLETS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_OUTLETS'] + }); } _fetchOutletList(cbfn) { diff --git a/client/src/page-manage-product-categories.html b/client/src/page-manage-product-categories.html index 021ffa71a..0a18f06eb 100644 --- a/client/src/page-manage-product-categories.html +++ b/client/src/page-manage-product-categories.html @@ -202,7 +202,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_INVENTORIES'] + }); } _fetchProductCategoryList(cbfn) { diff --git a/client/src/page-manage-sales-return.html b/client/src/page-manage-sales-return.html index 35024cf48..6e914fbf2 100644 --- a/client/src/page-manage-sales-return.html +++ b/client/src/page-manage-sales-return.html @@ -226,7 +226,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_SALES_RETURN']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_SALES_RETURN'] + }); } _fetchSalesReturnList(cbfn) { diff --git a/client/src/page-manage-sales.html b/client/src/page-manage-sales.html index 3047cda1b..89067a60e 100644 --- a/client/src/page-manage-sales.html +++ b/client/src/page-manage-sales.html @@ -255,7 +255,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_SALES'] + }); } _fetchSalesList(cbfn) { diff --git a/client/src/page-manage-warehouses.html b/client/src/page-manage-warehouses.html index ca7867d8e..2de090767 100644 --- a/client/src/page-manage-warehouses.html +++ b/client/src/page-manage-warehouses.html @@ -114,7 +114,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_WAREHOUSES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_WAREHOUSES'] + }); } _fetchWarehouseList(cbfn) { diff --git a/client/src/page-payment.html b/client/src/page-payment.html index 0feb640fe..7f1d95884 100644 --- a/client/src/page-payment.html +++ b/client/src/page-payment.html @@ -131,7 +131,9 @@ } _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } _processDashboardSummary(cbfn) { diff --git a/client/src/page-pos-select-products.html b/client/src/page-pos-select-products.html index 94bfd0596..1ce0533ea 100644 --- a/client/src/page-pos-select-products.html +++ b/client/src/page-pos-select-products.html @@ -199,7 +199,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_INVENTORIES'] + }); } _fetchInventoryDetails(cbfn) { diff --git a/client/src/page-pos.html b/client/src/page-pos.html index b82da04d4..3c0503553 100644 --- a/client/src/page-pos.html +++ b/client/src/page-pos.html @@ -368,7 +368,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_ACCESS_POS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_ACCESS_POS'] + }); } // region: pos ================================= diff --git a/client/src/page-print-sales-receipt.html b/client/src/page-print-sales-receipt.html index ecfb47c81..5408b3f99 100644 --- a/client/src/page-print-sales-receipt.html +++ b/client/src/page-print-sales-receipt.html @@ -325,7 +325,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_SALES'] + }); } _printAndGoBack() { diff --git a/client/src/page-report-inventories.html b/client/src/page-report-inventories.html index 314ff1053..b4a7f94e7 100644 --- a/client/src/page-report-inventories.html +++ b/client/src/page-report-inventories.html @@ -263,7 +263,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_INVENTORIES'] + }); } _fetchInventoriesData(cbfn) { diff --git a/client/src/page-report-sales.html b/client/src/page-report-sales.html index bc8a28e7b..dcc0ee911 100644 --- a/client/src/page-report-sales.html +++ b/client/src/page-report-sales.html @@ -333,7 +333,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_SALES'] + }); } _fetchSalesList(cbfn) { diff --git a/client/src/page-report-select-inventories.html b/client/src/page-report-select-inventories.html index e7e7b67b4..1e78865e9 100644 --- a/client/src/page-report-select-inventories.html +++ b/client/src/page-report-select-inventories.html @@ -142,7 +142,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_INVENTORIES'] + }); } _fetchInventoryList(cbfn) { diff --git a/client/src/page-settings.html b/client/src/page-settings.html index ae87305a4..95a595c74 100644 --- a/client/src/page-settings.html +++ b/client/src/page-settings.html @@ -172,7 +172,9 @@ } _ensureAccess() { - return this.accessControl('authenticated'); + return this.accessControl({ + authLevel: 'authenticated' + }); } // region: general settinggs ================================= diff --git a/client/src/page-view-customer.html b/client/src/page-view-customer.html index b233ff6b3..2e6b19c46 100644 --- a/client/src/page-view-customer.html +++ b/client/src/page-view-customer.html @@ -135,7 +135,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_CUSTOMER']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_CUSTOMER'] + }); } _fetchCustomer(cbfn) { diff --git a/client/src/page-view-employee.html b/client/src/page-view-employee.html index f32f2c589..804f1d7b1 100644 --- a/client/src/page-view-employee.html +++ b/client/src/page-view-employee.html @@ -105,7 +105,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_USERS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_USERS'] + }); } _fetchEmployee(cbfn) { diff --git a/client/src/page-view-inventory.html b/client/src/page-view-inventory.html index 8f9e3b7ee..3a1df4a3b 100644 --- a/client/src/page-view-inventory.html +++ b/client/src/page-view-inventory.html @@ -297,7 +297,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_INVENTORIES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_INVENTORIES'] + }); } _fetchInventoryDetails(cbfn) { diff --git a/client/src/page-view-outlet.html b/client/src/page-view-outlet.html index a21473524..b6be2aefc 100644 --- a/client/src/page-view-outlet.html +++ b/client/src/page-view-outlet.html @@ -209,7 +209,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_OUTLETS']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_OUTLETS'] + }); } _fetchOutlet(cbfn) { diff --git a/client/src/page-view-sales-return.html b/client/src/page-view-sales-return.html index 77ca61eed..d5c2f636d 100644 --- a/client/src/page-view-sales-return.html +++ b/client/src/page-view-sales-return.html @@ -108,7 +108,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_SALES_RETURN']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_SALES_RETURN'] + }); } _fetchSalesReturn(cbfn) { diff --git a/client/src/page-view-sales.html b/client/src/page-view-sales.html index d6d30b1d5..5eb86cc91 100644 --- a/client/src/page-view-sales.html +++ b/client/src/page-view-sales.html @@ -193,7 +193,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_SALES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_SALES'] + }); } _fetchSales(cbfn) { diff --git a/client/src/page-view-warehouse.html b/client/src/page-view-warehouse.html index 223ff4c49..f150d8875 100644 --- a/client/src/page-view-warehouse.html +++ b/client/src/page-view-warehouse.html @@ -124,7 +124,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_VIEW_ALL_WAREHOUSES']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_VIEW_ALL_WAREHOUSES'] + }); } _fetchWarehouse(cbfn) { diff --git a/client/src/page-withdraw-from-change-wallet-balance.html b/client/src/page-withdraw-from-change-wallet-balance.html index ea9f7adc1..812844223 100644 --- a/client/src/page-withdraw-from-change-wallet-balance.html +++ b/client/src/page-withdraw-from-change-wallet-balance.html @@ -110,7 +110,10 @@ } _ensureAccess() { - return this.accessControl('organization-selected', ['PRIV_MANAGE_CUSTOMER_WALLET_BALANCE']); + return this.accessControl({ + authLevel: 'organization-selected', + privilegeList: ['PRIV_MANAGE_CUSTOMER_WALLET_BALANCE'] + }); } // region: editCustomer =================================