1. 更新语法检查问题
This commit is contained in:
parent
94d735a1ca
commit
8947987ea3
|
@ -13,11 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.casbin.jcasbin.main.Enforcer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.cf.cs.database.pojo.entity.table.RoleTableDef.ROLE;
|
||||
|
@ -52,10 +48,10 @@ public class CasbinAuthorizeUtils {
|
|||
roleMapper.selectAll().forEach(role -> {
|
||||
if (!CasbinAuthorizeUtils.ENFORCER_POOL.containsKey(role.getName())) {
|
||||
String baseDir = System.getProperty("user.dir");
|
||||
String model = baseDir + "/" + casbinConfigure.getModelPath();
|
||||
String policy = baseDir + "/" + casbinConfigure.getPolicyPath();
|
||||
String model = baseDir + "/" + casbinConfigure.getModelPath();
|
||||
String policy = baseDir + "/" + casbinConfigure.getPolicyPath();
|
||||
|
||||
Enforcer e = new Enforcer(model, policy);
|
||||
Enforcer e = new Enforcer(model, policy);
|
||||
e.enableAutoSave(false);
|
||||
|
||||
List<Role> subRole = roleMapper.selectListByCondition(ROLE.ID.ge(role.getId()));
|
||||
|
@ -68,8 +64,8 @@ public class CasbinAuthorizeUtils {
|
|||
roleResourceService.getRoleResourceByRoleId(role.getId()).forEach(k -> {
|
||||
e.addPermissionForUser(role.getName(), k.getResources().getPath(), k.getResources().getHttpMethod(),
|
||||
Boolean.TRUE.equals(k.getAuthorize()) ? "allow" : "deny");
|
||||
log.trace("++++++[{}, {}, {}: {}]", role.getName(), k.getResources().getPath(),
|
||||
k.getResources().getHttpMethod(), Boolean.TRUE.equals(k.getAuthorize()) ? "allow" : "deny");
|
||||
log.trace("++++++[{}, {}, {}: {}]", role.getName(), k.getResources().getPath(), k.getResources().getHttpMethod(),
|
||||
Boolean.TRUE.equals(k.getAuthorize()) ? "allow" : "deny");
|
||||
});
|
||||
|
||||
// 缓存当前权限验证器
|
||||
|
@ -106,7 +102,7 @@ public class CasbinAuthorizeUtils {
|
|||
Enforcer se = CasbinAuthorizeUtils.ENFORCER_POOL.get(s);
|
||||
|
||||
if (s != null && (se.enforce(s, url, httpMethod))) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue