diff --git a/src/db/modify.sql b/src/db/modify.sql index b5502c9fc..1eb8d6787 100644 --- a/src/db/modify.sql +++ b/src/db/modify.sql @@ -138,4 +138,5 @@ ALTER TABLE sys_clients_customers ADD COLUMN channel varchar(15) not NULL ; ALTER TABLE sys_clients_customers ADD COLUMN last_payment_time datetime DEFAULT NULL COMMENT '最后一次付款时间'; +ALTER TABLE sys_org ADD COLUMN parent_org_id int(11) DEFAULT NULL; diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java index 90ddc9abd..658f5f7fa 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/core/impls/OrgManagerImpl.java @@ -68,7 +68,6 @@ public class OrgManagerImpl implements OrgManager { public JSONObject listAllOrgs(OrgInfo orgInfo,JSONObject manager) { /* PageBounds sort = new PageBounds(Order.formString("sort_no.asc")); return orgMapper.listsOrgWithDetail(sort);*/ - checkBdRole(manager); JSONObject params = orgInfo.toJsonParam(); PageList listOrg = orgMapper.listOrgWithPages(params,new PageBounds(orgInfo.getPage(),orgInfo.getLimit(),Order.formString("sort_no.asc"))); return PageListUtils.buildPageListResult(listOrg); @@ -76,7 +75,6 @@ public class OrgManagerImpl implements OrgManager { @Override public JSONObject getOrgDetail(int orgId,JSONObject manager) { - checkBdRole(manager); return orgMapper.findOne(orgId); } @@ -124,17 +122,6 @@ public class OrgManagerImpl implements OrgManager { return listAllOrgs; } - private void checkBdRole(JSONObject manager){ - if(ManagerRole.BD_USER.hasRole(manager.getIntValue("role"))){ - if(manager.getString("org_id") != null){ - JSONObject org = orgMapper.findOne(manager.getIntValue("org_id")); - if(org != null && org.getIntValue("type") == 0 && org.getString("parent_org_id") != null){ - throw new BadRequestException("Invalid Role"); - } - } - } - } - @Override public JSONObject checkOrg(JSONObject manager, JSONObject params){ if (params.getString("org_id")==null){ diff --git a/src/main/java/au/com/royalpay/payment/manage/organizations/web/OrgManageController.java b/src/main/java/au/com/royalpay/payment/manage/organizations/web/OrgManageController.java index 28f4698bd..f86ff0da7 100644 --- a/src/main/java/au/com/royalpay/payment/manage/organizations/web/OrgManageController.java +++ b/src/main/java/au/com/royalpay/payment/manage/organizations/web/OrgManageController.java @@ -49,13 +49,13 @@ public class OrgManageController { return orgManager.listAllOrg(); } - @ManagerMapping(method = RequestMethod.POST, role = {ManagerRole.ADMIN,ManagerRole.BD_USER}) + @ManagerMapping(method = RequestMethod.POST, role = {ManagerRole.ADMIN}) public JSONObject saveOrg(@RequestBody @Valid OrgInfo org, Errors errors) { HttpUtils.handleValidErrors(errors); return orgManager.saveNewOrg(org); } - @ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN,ManagerRole.BD_USER}) + @ManagerMapping(value = "/{orgId}", method = RequestMethod.GET, role = {ManagerRole.ADMIN}) public JSONObject getOrgDetail(@PathVariable int orgId,@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return orgManager.getOrgDetail(orgId,manager); } @@ -66,7 +66,7 @@ public class OrgManageController { orgManager.updateOrg(orgId, org); } - @ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN,ManagerRole.BD_USER}) + @ManagerMapping(value = "/{orgId}/enable_change_rate",method = RequestMethod.PUT,role = {ManagerRole.ADMIN}) public void switchEnableChangeRate(@PathVariable int orgId, @RequestBody JSONObject enable){ boolean enabled = enable.getBooleanValue("enabled"); orgManager.switchPermission(orgId,"rate_editable",enabled); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java index 82413d448..adf5d191f 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerAccountServiceImpl.java @@ -31,7 +31,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { @Override public List listManagers(JSONObject loginManager) { - checkBdRole(loginManager); JSONObject params = new JSONObject(); if (loginManager.getInteger("org_id") != null) { params.put("org_id", loginManager.getIntValue("org_id")); @@ -58,7 +57,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { @Override public void saveManager(ManagerInfo manager, JSONObject loginManager) { - checkBdRole(loginManager); if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))) { if (manager.isAdmin() || manager.isFinacial() || manager.isOperator() || manager.isServant() || manager.isSitemanager() || manager.isDeveloper()) { throw new BadRequestException("Invalid Role"); @@ -74,7 +72,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { @Override public void modify(String userId, ManagerInfo manager, JSONObject loginManager) { - checkBdRole(loginManager); JSONObject managerFromDb = managerMapper.findById(userId); if (managerFromDb == null) { throw new NotFoundException("manager not exists or invalid"); @@ -95,7 +92,6 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { @Override public void disable(String userId, JSONObject loginManager) { - checkBdRole(loginManager); JSONObject manager = managerMapper.findById(userId); if (!ManagerRole.ADMIN.hasRole(loginManager.getIntValue("role")) && !ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))){ if (manager.getIntValue("org_id") != loginManager.getIntValue("org_id")) { @@ -127,15 +123,4 @@ public class ManagerAccountServiceImpl implements ManagerAccountsService { return financialBDConfigMapper.getBdConfig(bd_id); } - private void checkBdRole(JSONObject loginManager){ - if(ManagerRole.BD_USER.hasRole(loginManager.getIntValue("role"))){ - JSONObject manager = managerMapper.findById(loginManager.getString("manager_id")); - if(manager.getString("org_id") != null){ - JSONObject org = orgMapper.findOne(manager.getIntValue("org_id")); - if(org != null && org.getIntValue("type") == 0 && org.getString("parent_org_id") != null){ - throw new BadRequestException("Invalid Role"); - } - } - } - } } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java index b93a106bf..06c607702 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerAccountsController.java @@ -36,14 +36,14 @@ public class ManagerAccountsController { // } @RequestMapping(method = RequestMethod.GET) - @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER}) + @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) public List listManagerss(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager, @RequestParam Map map) { loginManager.putAll(map); return managerAccountsService.listManagers(loginManager); } @RequestMapping(method = RequestMethod.POST) - @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER}) + @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) public void saveManager(@RequestBody @Valid ManagerInfo manager, Errors errors, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) { HttpUtils.handleValidErrors(errors); managerAccountsService.saveManager(manager, loginManager); @@ -61,12 +61,12 @@ public class ManagerAccountsController { return managerAccountsService.listBDUsers(params); } - @ManagerMapping(value = "/{userId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER}) + @ManagerMapping(value = "/{userId}", method = RequestMethod.PUT, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) public void modify(@PathVariable String userId, @RequestBody ManagerInfo manager, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) { managerAccountsService.modify(userId, manager, loginManager); } - @ManagerMapping(value = "/{userId}", method = RequestMethod.DELETE, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER,ManagerRole.BD_USER}) + @ManagerMapping(value = "/{userId}", method = RequestMethod.DELETE, role = {ManagerRole.ADMIN, ManagerRole.ACCOUNT_MANAGER}) public void disableUser(@PathVariable String userId, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject loginManager) { managerAccountsService.disable(userId, loginManager); } diff --git a/src/main/ui/static/config/organizations/templates/org_detail.html b/src/main/ui/static/config/organizations/templates/org_detail.html index cd634a020..c23704ac5 100644 --- a/src/main/ui/static/config/organizations/templates/org_detail.html +++ b/src/main/ui/static/config/organizations/templates/org_detail.html @@ -192,6 +192,7 @@ + @@ -237,6 +238,7 @@ + Modify diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index 4b38b57b2..6be647567 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -148,7 +148,7 @@ -
+