Static object session with search verb allows to search all objects in container #155

Merged
fyrchik merged 2 commits from dstepanov-yadro/frostfs-node:bugfix/object-1982_session_token_search into master 2023-03-22 07:21:10 +00:00
Showing only changes of commit 97b9d165e6 - Show all commits

View file

@ -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
}