|
@@ -8,7 +8,7 @@ import com.boman.common.redis.service.RedisService;
|
|
|
import com.boman.domain.GenTable;
|
|
|
import com.boman.domain.SysRoleData;
|
|
|
import com.boman.domain.constant.FormDataConstant;
|
|
|
-import com.boman.domain.exception.UnSuchFunctionException;
|
|
|
+import com.boman.domain.exception.NoSuchFunctionException;
|
|
|
import com.boman.system.api.RemoteMenuService;
|
|
|
import com.boman.system.api.RemoteRoleDataService;
|
|
|
import com.boman.system.api.domain.SysMenu;
|
|
@@ -80,7 +80,7 @@ public class AuthUtils {
|
|
|
*/
|
|
|
public static void containsFunction(String menuRole, String funcType, String errMsg) {
|
|
|
if (!menuRole.contains(funcType)) {
|
|
|
- throw new UnSuchFunctionException(errMsg);
|
|
|
+ throw new NoSuchFunctionException(errMsg);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
@@ -150,7 +150,7 @@ public class AuthUtils {
|
|
|
String perms = packPermsKey(tableName, funcType);
|
|
|
if (!permsList.contains(perms)) {
|
|
|
LOGGER.error("非法操作,操作人: {},tableName: {}, 操作类型: {}", getLoginUser().getUsername(), tableName, funcType(funcType));
|
|
|
- throw new UnSuchFunctionException("不好意思,您无权限操作");
|
|
|
+ throw new NoSuchFunctionException("不好意思,您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -190,7 +190,7 @@ public class AuthUtils {
|
|
|
// 不可以修改
|
|
|
if (!countByCreteBy(dataScope, pkName, id, tableName)) {
|
|
|
LOGGER.error("非法操作,操作人: {},tableName: {}, id: {}", getLoginUser().getUsername(), tableName, id);
|
|
|
- throw new UnSuchFunctionException("不好意思,您无权限操作");
|
|
|
+ throw new NoSuchFunctionException("不好意思,您无权限操作");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -231,13 +231,16 @@ public class AuthUtils {
|
|
|
*/
|
|
|
public static boolean countByCreteBy(String dataScope, String pkName, Long id, String tableName) {
|
|
|
ICommonService commonService = SpringUtils.getBean(ICommonService.class);
|
|
|
+
|
|
|
JSONObject condition = new JSONObject();
|
|
|
condition.put(pkName, id);
|
|
|
// 封装crete_by
|
|
|
packAuthCondition(dataScope, condition, getLoginUser());
|
|
|
+
|
|
|
FormDataDto dto = new FormDataDto();
|
|
|
dto.setTable(tableName);
|
|
|
dto.setFixedData(condition);
|
|
|
+
|
|
|
int count = commonService.count(dto);
|
|
|
// count > 0 证明此人可以看到这条记录,自然可以修改
|
|
|
return count > 0;
|