Finish the basic share code validate.
This commit is contained in:
@ -17,6 +17,7 @@ type AlienService struct {
|
||||
userDao *UserDao
|
||||
uploadTokenDao *UploadTokenDao
|
||||
downloadTokenDao *DownloadTokenDao
|
||||
shareService *ShareService
|
||||
imageCacheDao *ImageCacheDao
|
||||
imageCacheService *ImageCacheService
|
||||
}
|
||||
@ -51,6 +52,11 @@ func (this *AlienService) Init() {
|
||||
this.downloadTokenDao = c
|
||||
}
|
||||
|
||||
b = core.CONTEXT.GetBean(this.shareService)
|
||||
if c, ok := b.(*ShareService); ok {
|
||||
this.shareService = c
|
||||
}
|
||||
|
||||
b = core.CONTEXT.GetBean(this.imageCacheDao)
|
||||
if c, ok := b.(*ImageCacheDao); ok {
|
||||
this.imageCacheDao = c
|
||||
@ -105,8 +111,15 @@ func (this *AlienService) PreviewOrDownload(
|
||||
|
||||
//判断文件的所属人是否正确
|
||||
operator := this.findUser(writer, request)
|
||||
if operator == nil || (operator.Role != USER_ROLE_ADMINISTRATOR && matter.UserUuid != operator.Uuid) {
|
||||
|
||||
//可以使用分享码的形式授权。
|
||||
shareUuid := request.FormValue("shareUuid")
|
||||
shareCode := request.FormValue("shareCode")
|
||||
shareRootUuid := request.FormValue("shareRootUuid")
|
||||
if shareUuid == "" || shareCode == "" || shareRootUuid == "" {
|
||||
panic(result.UNAUTHORIZED)
|
||||
} else {
|
||||
this.shareService.ValidateMatter(shareUuid, shareCode, operator, shareRootUuid, matter)
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user