diff --git a/src/controllers/03-customer-branch-citizen-controller.ts b/src/controllers/03-customer-branch-citizen-controller.ts index 75110c3..f17b746 100644 --- a/src/controllers/03-customer-branch-citizen-controller.ts +++ b/src/controllers/03-customer-branch-citizen-controller.ts @@ -23,15 +23,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", - "sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } type CustomerBranchCitizenPayload = { diff --git a/src/controllers/03-customer-branch-controller.ts b/src/controllers/03-customer-branch-controller.ts index 5c94a2f..529700b 100644 --- a/src/controllers/03-customer-branch-controller.ts +++ b/src/controllers/03-customer-branch-controller.ts @@ -47,15 +47,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", - "sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } const permissionCondCompany = createPermCondition((_) => true); diff --git a/src/controllers/03-customer-controller.ts b/src/controllers/03-customer-controller.ts index 122726f..bfc327d 100644 --- a/src/controllers/03-customer-controller.ts +++ b/src/controllers/03-customer-controller.ts @@ -42,15 +42,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", - "sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } const permissionCondCompany = createPermCondition((_) => true); diff --git a/src/controllers/03-employee-checkup-controller.ts b/src/controllers/03-employee-checkup-controller.ts index a72ad2d..71ceafd 100644 --- a/src/controllers/03-employee-checkup-controller.ts +++ b/src/controllers/03-employee-checkup-controller.ts @@ -23,14 +23,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } type EmployeeCheckupPayload = { diff --git a/src/controllers/03-employee-controller.ts b/src/controllers/03-employee-controller.ts index a6d67c1..797a994 100644 --- a/src/controllers/03-employee-controller.ts +++ b/src/controllers/03-employee-controller.ts @@ -51,14 +51,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } const permissionCond = createPermCondition(globalAllow); diff --git a/src/controllers/03-employee-other-info-controller.ts b/src/controllers/03-employee-other-info-controller.ts index d6b73e7..bc85efc 100644 --- a/src/controllers/03-employee-other-info-controller.ts +++ b/src/controllers/03-employee-other-info-controller.ts @@ -23,14 +23,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } type EmployeeOtherInfoPayload = { diff --git a/src/controllers/03-employee-passport-controller.ts b/src/controllers/03-employee-passport-controller.ts index 6af121c..1d17e07 100644 --- a/src/controllers/03-employee-passport-controller.ts +++ b/src/controllers/03-employee-passport-controller.ts @@ -22,14 +22,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } type EmployeePassportPayload = { diff --git a/src/controllers/03-employee-visa-controller.ts b/src/controllers/03-employee-visa-controller.ts index b1fe09d..a5af041 100644 --- a/src/controllers/03-employee-visa-controller.ts +++ b/src/controllers/03-employee-visa-controller.ts @@ -22,14 +22,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } type EmployeeVisaPayload = { diff --git a/src/controllers/03-employee-work-controller.ts b/src/controllers/03-employee-work-controller.ts index 3704546..7671c2a 100644 --- a/src/controllers/03-employee-work-controller.ts +++ b/src/controllers/03-employee-work-controller.ts @@ -22,14 +22,16 @@ const MANAGE_ROLES = [ "system", "head_of_admin", "admin", - "head_of_accountant", + "executive", "accountant", - "head_of_sale", + "branch_admin", + "branch_manager", + "branch_accountant", ]; function globalAllow(user: RequestWithUser["user"]) { - const allowList = ["system", "head_of_admin", "head_of_accountant", "head_of_sale"]; - return allowList.some((v) => user.roles?.includes(v)); + const listAllowed = ["system", "head_of_admin", "admin", "executive", "accountant"]; + return user.roles?.some((v) => listAllowed.includes(v)) || false; } type EmployeeWorkPayload = {