@ -352,7 +352,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
MultipartFile file ) {
Result < Object > result = new Result < > ( ) ;
String funcPermissionKey = type . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_UPDATE : ApiFuncIdentificationConstant . UDF_UPDATE ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , checkResourceType ( type ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
putMsg ( result , Status . NO_CURRENT_OPERATING_PERMISSION ) ;
return result ;
@ -640,8 +640,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
}
}
PageInfo < Resource > pageInfo = new PageInfo < > ( pageNo , pageSize ) ;
Set < Integer > resourcesIds = resourcePermissionCheckService . userOwnedResourceIdsAcquisition ( AuthorizationType . RESOURCE_FILE_ID , loginUser . getId ( ) , logger ) ;
Set < Integer > resourcesIds = resourcePermissionCheckService . userOwnedResourceIdsAcquisition ( checkResourceType ( type ) , loginUser . getId ( ) , logger ) ;
if ( resourcesIds . isEmpty ( ) ) {
result . setData ( pageInfo ) ;
putMsg ( result , Status . SUCCESS ) ;
@ -767,7 +766,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
return result ;
}
Set < Integer > resourceIds = resourcePermissionCheckService . userOwnedResourceIdsAcquisition ( AuthorizationType . RESOURCE_FILE_ID , loginUser . getId ( ) , logger ) ;
Set < Integer > resourceIds = resourcePermissionCheckService . userOwnedResourceIdsAcquisition ( checkResourceType ( type ) , loginUser . getId ( ) , logger ) ;
if ( resourceIds . isEmpty ( ) ) {
result . setData ( Collections . emptyList ( ) ) ;
putMsg ( result , Status . SUCCESS ) ;
@ -813,7 +812,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
return resultCheck ;
}
String funcPermissionKey = resource . getType ( ) . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_DELETE : ApiFuncIdentificationConstant . UDF_DELETE ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , checkResourceType ( resource . getType ( ) ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
putMsg ( resultCheck , Status . NO_CURRENT_OPERATING_PERMISSION ) ;
return resultCheck ;
@ -964,7 +963,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
}
}
String funcPermissionKey = type . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_VIEW : ApiFuncIdentificationConstant . UDF_FILE_VIEW ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resource . getId ( ) } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resource . getId ( ) } , checkResourceType ( type ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
putMsg ( result , Status . NO_CURRENT_OPERATING_PERMISSION ) ;
return result ;
@ -988,7 +987,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
return result ;
}
String funcPermissionKey = resource . getType ( ) . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_VIEW : ApiFuncIdentificationConstant . UDF_FILE_VIEW ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { id } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { id } , checkResourceType ( resource . getType ( ) ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
putMsg ( result , Status . NO_CURRENT_OPERATING_PERMISSION ) ;
return result ;
@ -1019,7 +1018,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
return result ;
}
String funcPermissionKey = resource . getType ( ) . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_VIEW : ApiFuncIdentificationConstant . UDF_FILE_VIEW ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , checkResourceType ( resource . getType ( ) ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
putMsg ( result , Status . NO_CURRENT_OPERATING_PERMISSION ) ;
return result ;
@ -1125,7 +1124,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
updateParentResourceSize ( resource , resource . getSize ( ) ) ;
putMsg ( result , Status . SUCCESS ) ;
permissionPostHandle ( AuthorizationType . RESOURCE_FILE_ID , loginUser . getId ( ) , Collections . singletonList ( resource . getId ( ) ) , logger ) ;
permissionPostHandle ( checkResourceType ( resource . getType ( ) ) , loginUser . getId ( ) , Collections . singletonList ( resource . getId ( ) ) , logger ) ;
Map < String , Object > resultMap = new HashMap < > ( ) ;
for ( Map . Entry < Object , Object > entry : new BeanMap ( resource ) . entrySet ( ) ) {
if ( ! Constants . CLASS . equalsIgnoreCase ( entry . getKey ( ) . toString ( ) ) ) {
@ -1202,7 +1201,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
return result ;
}
String funcPermissionKey = resource . getType ( ) . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_UPDATE : ApiFuncIdentificationConstant . UDF_UPDATE ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , checkResourceType ( resource . getType ( ) ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
putMsg ( result , Status . NO_CURRENT_OPERATING_PERMISSION ) ;
return result ;
@ -1304,7 +1303,7 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
}
String funcPermissionKey = resource . getType ( ) . equals ( ResourceType . FILE ) ? ApiFuncIdentificationConstant . FILE_DOWNLOAD : ApiFuncIdentificationConstant . UDF_DOWNLOAD ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , AuthorizationType . RESOURCE_FILE_ID , funcPermissionKey ) ;
boolean canOperatorPermissions = canOperatorPermissions ( loginUser , new Object [ ] { resourceId } , checkResourceType ( resource . getType ( ) ) , funcPermissionKey ) ;
if ( ! canOperatorPermissions ) {
logger . error ( "{}: {}" , Status . NO_CURRENT_OPERATING_PERMISSION . getMsg ( ) , PropertyUtils . getResUploadStartupState ( ) ) ;
throw new ServiceException ( Status . NO_CURRENT_OPERATING_PERMISSION . getMsg ( ) ) ;
@ -1341,8 +1340,6 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
logger . error ( "download resource error, the path is {}, and local filename is {}, the error message is {}" , fileName , localFileName , e . getMessage ( ) ) ;
throw new ServerException ( "download the resource file failed ,it may be related to your storage" ) ;
}
}
/ * *
@ -1608,4 +1605,8 @@ public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesSe
List < Integer > resIds = resourceUserMapper . queryResourcesIdListByUserIdAndPerm ( userId , perm ) ;
return CollectionUtils . isEmpty ( resIds ) ? new ArrayList < > ( ) : resourcesMapper . queryResourceListById ( resIds ) ;
}
private AuthorizationType checkResourceType ( ResourceType type ) {
return type . equals ( ResourceType . FILE ) ? AuthorizationType . RESOURCE_FILE_ID : AuthorizationType . UDF_FILE ;
}
}