mirror of
https://github.com/eyebluecn/tank.git
synced 2026-10-19 16:14:38 +00:00
fix: refine the share's things.
This commit is contained in:
@@ -394,7 +394,7 @@ func (this *ShareController) MatterPage(writer http.ResponseWriter, request *htt
|
||||
|
||||
//validate the shareUuid,shareCode,shareRootUuid.
|
||||
user := this.findUser(request)
|
||||
this.shareService.ValidateMatter(request, shareUuid, shareCode, user, shareRootUuid, dirMatter)
|
||||
share := this.shareService.ValidateMatter(request, shareUuid, shareCode, user, shareRootUuid, dirMatter)
|
||||
puuid = dirMatter.Uuid
|
||||
|
||||
var extensions []string
|
||||
@@ -419,7 +419,7 @@ func (this *ShareController) MatterPage(writer http.ResponseWriter, request *htt
|
||||
dir,
|
||||
deleted,
|
||||
extensions,
|
||||
dirMatter.SpaceUuid,
|
||||
share.SpaceUuid,
|
||||
)
|
||||
|
||||
return this.Success(pager)
|
||||
|
||||
@@ -75,17 +75,12 @@ func (this *ShareService) CheckShare(request *http.Request, shareUuid string, co
|
||||
}
|
||||
|
||||
// check whether a user can access a matter. shareRootUuid is matter's parent(or parent's parent and so on)
|
||||
func (this *ShareService) ValidateMatter(request *http.Request, shareUuid string, code string, user *User, shareRootUuid string, matter *Matter) {
|
||||
func (this *ShareService) ValidateMatter(request *http.Request, shareUuid string, code string, user *User, shareRootUuid string, matter *Matter) *Share {
|
||||
|
||||
if matter == nil {
|
||||
panic(result.Unauthorized("matter cannot be nil"))
|
||||
}
|
||||
|
||||
//if self's matter, ok.
|
||||
if user != nil && matter.UserUuid == user.Uuid {
|
||||
return
|
||||
}
|
||||
|
||||
if shareUuid == "" || code == "" || shareRootUuid == "" {
|
||||
panic(result.Unauthorized("shareUuid,code,shareRootUuid cannot be null"))
|
||||
}
|
||||
@@ -114,6 +109,8 @@ func (this *ShareService) ValidateMatter(request *http.Request, shareUuid string
|
||||
}
|
||||
}
|
||||
|
||||
return share
|
||||
|
||||
}
|
||||
|
||||
// delete user's shares and corresponding bridges.
|
||||
|
||||
Reference in New Issue
Block a user