mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 09:28:49 +08:00
fix refreshAllDynamicRoles
This commit is contained in:
parent
68de75ca6b
commit
78fd64d27a
@ -18,12 +18,14 @@
|
|||||||
package org.maxkey.persistence.service;
|
package org.maxkey.persistence.service;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.sql.Types;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
import org.apache.mybatis.jpa.persistence.JpaBaseService;
|
||||||
import org.maxkey.constants.ConstsStatus;
|
import org.maxkey.constants.ConstsStatus;
|
||||||
|
import org.maxkey.entity.Institutions;
|
||||||
import org.maxkey.entity.Roles;
|
import org.maxkey.entity.Roles;
|
||||||
import org.maxkey.persistence.mapper.RolesMapper;
|
import org.maxkey.persistence.mapper.RolesMapper;
|
||||||
import org.maxkey.util.StringUtils;
|
import org.maxkey.util.StringUtils;
|
||||||
@ -46,6 +48,9 @@ public class RolesService extends JpaBaseService<Roles> implements Serializable
|
|||||||
@Autowired
|
@Autowired
|
||||||
RoleMemberService roleMemberService;
|
RoleMemberService roleMemberService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
InstitutionsService institutionsService;
|
||||||
|
|
||||||
public RolesService() {
|
public RolesService() {
|
||||||
super(RolesMapper.class);
|
super(RolesMapper.class);
|
||||||
}
|
}
|
||||||
@ -95,9 +100,22 @@ public class RolesService extends JpaBaseService<Roles> implements Serializable
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(dynamicRole.getOrgIdsList())) {
|
if(StringUtils.isNotBlank(dynamicRole.getOrgIdsList())) {
|
||||||
dynamicRole.setOrgIdsList("'"+dynamicRole.getOrgIdsList().replace(",", "','")+"'");
|
String []orgIds = dynamicRole.getOrgIdsList().split(",");
|
||||||
|
StringBuffer orgIdFilters = new StringBuffer();
|
||||||
|
for(String orgId : orgIds) {
|
||||||
|
if(StringUtils.isNotBlank(orgId)) {
|
||||||
|
if(orgIdFilters.length() > 0) {
|
||||||
|
orgIdFilters.append(",");
|
||||||
|
}
|
||||||
|
orgIdFilters.append("'").append(orgId).append("'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(orgIdFilters.length() > 0) {
|
||||||
|
dynamicRole.setOrgIdsList(orgIdFilters.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String filters = dynamicRole.getFilters();
|
String filters = dynamicRole.getFilters();
|
||||||
if(StringUtils.isNotBlank(filters)) {
|
if(StringUtils.isNotBlank(filters)) {
|
||||||
if(StringUtils.filtersSQLInjection(filters.toLowerCase())) {
|
if(StringUtils.filtersSQLInjection(filters.toLowerCase())) {
|
||||||
@ -125,11 +143,17 @@ public class RolesService extends JpaBaseService<Roles> implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAllDynamicRoles(){
|
public void refreshAllDynamicRoles(){
|
||||||
List<Roles> groupsList = queryDynamicRoles(null);
|
List<Institutions> instList =
|
||||||
for(Roles group : groupsList) {
|
institutionsService.find("where status = ? ", new Object[]{ConstsStatus.ACTIVE}, new int[]{Types.INTEGER});
|
||||||
_logger.debug("group " + group);
|
for(Institutions inst : instList) {
|
||||||
refreshDynamicRoles(group);
|
Roles role = new Roles();
|
||||||
}
|
role.setId(inst.getId());
|
||||||
|
List<Roles> rolesList = queryDynamicRoles(role);
|
||||||
|
for(Roles r : rolesList) {
|
||||||
|
_logger.debug("role " + rolesList);
|
||||||
|
refreshDynamicRoles(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user