|
|
@@ -13,6 +13,7 @@ import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author reghao
|
|
|
@@ -45,41 +46,16 @@ public class PermissionServiceImpl implements PermissionService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setObjectPermission(String objectName, int acl) {
|
|
|
- }
|
|
|
-
|
|
|
- public void setImagePermission(String imageFileId, int acl) {
|
|
|
- fileMetaMapper.updateSetAcl(imageFileId, acl);
|
|
|
-
|
|
|
- ImageFile imageFile = imageFileMapper.findByImageFileId(imageFileId);
|
|
|
- String jpegObjectId = imageFile.getJpegObjectId();
|
|
|
- fileMetaMapper.updateSetAcl(jpegObjectId, acl);
|
|
|
-
|
|
|
- String webpObjectId = imageFile.getWebpObjectId();
|
|
|
- if (webpObjectId != null) {
|
|
|
- fileMetaMapper.updateSetAcl(webpObjectId, acl);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void setAudioPermission(String audioFileId, int acl) {
|
|
|
- fileMetaMapper.updateSetAcl(audioFileId, acl);
|
|
|
-
|
|
|
- AudioFile audioFile = audioFileMapper.findByAudioFileId(audioFileId);
|
|
|
- String objectId = audioFile.getObjectId();
|
|
|
- fileMetaMapper.updateSetAcl(objectId, acl);
|
|
|
- }
|
|
|
-
|
|
|
- public void setVideoPermission(String videoFileId, int acl) {
|
|
|
- fileMetaMapper.updateSetAcl(videoFileId, acl);
|
|
|
-
|
|
|
- List<VideoUrl> list = videoUrlMapper.findByVideoFileId(videoFileId);
|
|
|
- for (VideoUrl videoUrl : list) {
|
|
|
- String objectId = videoUrl.getObjectId();
|
|
|
- fileMetaMapper.updateSetAcl(objectId, acl);
|
|
|
+ public void setVideoPermission(String videoFileId, int scope) {
|
|
|
+ List<String> objectIds = videoUrlMapper.findByVideoFileId(videoFileId).stream()
|
|
|
+ .map(VideoUrl::getObjectId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!objectIds.isEmpty()) {
|
|
|
+ fileMetaMapper.updateScopeByObjectIds(scope, objectIds);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void getObjectPermission(String objectName) {
|
|
|
+ public void setImagePermission(String imageFileId, int scope) {
|
|
|
}
|
|
|
}
|