|
@@ -300,13 +300,13 @@ export function createCrudRoutes<
|
|
|
const user = c.get('user');
|
|
const user = c.get('user');
|
|
|
|
|
|
|
|
// 如果配置了数据权限,检查用户是否有权限访问该资源
|
|
// 如果配置了数据权限,检查用户是否有权限访问该资源
|
|
|
- if (dataPermissionService && dataPermissionConfig && user) {
|
|
|
|
|
|
|
+ if (dataPermissionService && dataPermission && user) {
|
|
|
const hasPermission = await dataPermissionService.checkDataPermission(
|
|
const hasPermission = await dataPermissionService.checkDataPermission(
|
|
|
user,
|
|
user,
|
|
|
entity.name,
|
|
entity.name,
|
|
|
id,
|
|
id,
|
|
|
'view',
|
|
'view',
|
|
|
- dataPermissionConfig
|
|
|
|
|
|
|
+ dataPermission
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (!hasPermission) {
|
|
if (!hasPermission) {
|
|
@@ -338,13 +338,13 @@ export function createCrudRoutes<
|
|
|
const user = c.get('user');
|
|
const user = c.get('user');
|
|
|
|
|
|
|
|
// 如果配置了数据权限,检查用户是否有权限更新该资源
|
|
// 如果配置了数据权限,检查用户是否有权限更新该资源
|
|
|
- if (dataPermissionService && dataPermissionConfig && user) {
|
|
|
|
|
|
|
+ if (dataPermissionService && dataPermission && user) {
|
|
|
const hasPermission = await dataPermissionService.checkDataPermission(
|
|
const hasPermission = await dataPermissionService.checkDataPermission(
|
|
|
user,
|
|
user,
|
|
|
entity.name,
|
|
entity.name,
|
|
|
id,
|
|
id,
|
|
|
'update',
|
|
'update',
|
|
|
- dataPermissionConfig
|
|
|
|
|
|
|
+ dataPermission
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (!hasPermission) {
|
|
if (!hasPermission) {
|
|
@@ -375,13 +375,13 @@ export function createCrudRoutes<
|
|
|
const user = c.get('user');
|
|
const user = c.get('user');
|
|
|
|
|
|
|
|
// 如果配置了数据权限,检查用户是否有权限删除该资源
|
|
// 如果配置了数据权限,检查用户是否有权限删除该资源
|
|
|
- if (dataPermissionService && dataPermissionConfig && user) {
|
|
|
|
|
|
|
+ if (dataPermissionService && dataPermission && user) {
|
|
|
const hasPermission = await dataPermissionService.checkDataPermission(
|
|
const hasPermission = await dataPermissionService.checkDataPermission(
|
|
|
user,
|
|
user,
|
|
|
entity.name,
|
|
entity.name,
|
|
|
id,
|
|
id,
|
|
|
'delete',
|
|
'delete',
|
|
|
- dataPermissionConfig
|
|
|
|
|
|
|
+ dataPermission
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if (!hasPermission) {
|
|
if (!hasPermission) {
|