master
wangning 6 years ago
parent 329d8fab4d
commit 8523b40ffb

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

Loading…
Cancel
Save