master
wangning 6 years ago
parent 329d8fab4d
commit 8523b40ffb

@ -46,7 +46,6 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
@Resource @Resource
private ClientMapper clientMapper; private ClientMapper clientMapper;
@Override @Override
public void synchronizeFunctions() { public void synchronizeFunctions() {
List<JSONObject> functions = permissionPartnerFunctionMapper.listAll(); List<JSONObject> functions = permissionPartnerFunctionMapper.listAll();
@ -112,7 +111,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
} }
@Override @Override
public void permissionClientModuleSave(int clientId,String clientMoniker) { public void permissionClientModuleSave(int clientId, String clientMoniker) {
List<JSONObject> moduleId = permissionPartnerModuleMapper.list(); List<JSONObject> moduleId = permissionPartnerModuleMapper.list();
for (JSONObject moduleClientAdd : moduleId) { for (JSONObject moduleClientAdd : moduleId) {
moduleClientAdd.put("client_id", clientId); moduleClientAdd.put("client_id", clientId);
@ -122,7 +121,6 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
permissionClientModulesService.save(moduleClientAdd); permissionClientModulesService.save(moduleClientAdd);
} }
} }
@Override @Override
@ -140,35 +138,20 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
permissionPartnerModuleMapper.save(mod); permissionPartnerModuleMapper.save(mod);
List<JSONObject> IdandMoniker = clientMapper.listClientsIdAndMoniker(); List<JSONObject> IdandMoniker = clientMapper.listClientsIdAndMoniker();
JSONObject nModuleId = permissionPartnerModuleMapper.listModuleId(moduleName); JSONObject nModuleId = permissionPartnerModuleMapper.listModuleId(moduleName);
for (JSONObject clientMod : IdandMoniker) {
if (module.getInitialize()) { clientMod.put("client_id", clientMod.getString("client_id"));
for (JSONObject clientMod : IdandMoniker) { clientMod.put("client_moniker", clientMod.getString("client_moniker"));
clientMod.put("client_id", clientMod.getString("client_id")); clientMod.put("module_id", nModuleId.getString("id"));
clientMod.put("client_moniker", clientMod.getString("client_moniker")); clientMod.put("is_valid", module.getInitialize());
clientMod.put("module_id", nModuleId.getString("id")); clientMod.put("id", IdUtil.getId());
clientMod.put("is_valid", 1); permissionClientModulesService.save(clientMod);
clientMod.put("id", IdUtil.getId());
permissionClientModulesService.save(clientMod);
}
} else {
for (JSONObject clientMod : IdandMoniker) {
clientMod.put("client_id", clientMod.getString("client_id"));
clientMod.put("client_moniker", clientMod.getString("client_moniker"));
clientMod.put("module_id", nModuleId.getString("id"));
clientMod.put("is_valid", 0);
clientMod.put("id", IdUtil.getId());
permissionClientModuleMapper.save(clientMod);
}
}
} }
module.initObject(mod);
permissionPartnerModuleMapper.update(mod);
} }
module.initObject(mod);
permissionPartnerModuleMapper.update(mod);
}
@Override @Override
public void checkAndDeleteModule(String moduleName) { public void checkAndDeleteModule(String moduleName) {
@ -192,7 +175,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
} }
@Override @Override
@CacheEvict(value = ":login:managers:",allEntries = true) @CacheEvict(value = ":login:managers:", allEntries = true)
public void setFunctionModule(String funcId, String moduleName) { public void setFunctionModule(String funcId, String moduleName) {
if (moduleName == null) { if (moduleName == null) {
throw new BadRequestException("module name not provided"); throw new BadRequestException("module name not provided");
@ -205,7 +188,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
JSONObject update = new JSONObject(); JSONObject update = new JSONObject();
update.put("func_id", funcId); update.put("func_id", funcId);
update.put("module", moduleName); update.put("module", moduleName);
update.put("module_id",nModuleId.getString("id")); update.put("module_id", nModuleId.getString("id"));
permissionPartnerFunctionMapper.update(update); permissionPartnerFunctionMapper.update(update);
} }
@ -221,7 +204,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager {
@Override @Override
@Transactional @Transactional
@CacheEvict(value = ":login:managers:",allEntries = true) @CacheEvict(value = ":login:managers:", allEntries = true)
public void authorizeRole(ManagerRole role, List<String> functions) { public void authorizeRole(ManagerRole role, List<String> functions) {
permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask()); permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask());
permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions); permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions);

Loading…
Cancel
Save