[#155] search-service: Fix search with ST
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
Search should return only objects allowed in static session Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
1637a3edce
commit
49234b915e
1 changed files with 15 additions and 0 deletions
|
@ -119,6 +119,7 @@ func (exec *execCtx) generateTraverser(cnr cid.ID) (*placement.Traverser, bool)
|
|||
}
|
||||
|
||||
func (exec *execCtx) writeIDList(ids []oid.ID) {
|
||||
ids = exec.filterAllowedObjectIDs(ids)
|
||||
err := exec.prm.writer.WriteIDs(ids)
|
||||
|
||||
switch {
|
||||
|
@ -134,3 +135,17 @@ func (exec *execCtx) writeIDList(ids []oid.ID) {
|
|||
exec.err = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (exec *execCtx) filterAllowedObjectIDs(objIDs []oid.ID) []oid.ID {
|
||||
sessionToken := exec.prm.common.SessionToken()
|
||||
if sessionToken == nil {
|
||||
return objIDs
|
||||
}
|
||||
result := make([]oid.ID, 0, len(objIDs))
|
||||
for _, objID := range objIDs {
|
||||
if sessionToken.AssertObject(objID) {
|
||||
result = append(result, objID)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue