Skip to content

fix: get all memory in team with permission=me - #16593

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
Haruko386:mutex
Jul 3, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
Haruko386:mutex

Conversation

@Haruko386

@Haruko386 Haruko386 commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

Summary

As title:

bug:
image

fixed:
image

@Haruko386 Haruko386 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Jul 3, 2026
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 3, 2026
@Haruko386
Haruko386 marked this pull request as draft July 3, 2026 06:02
@Haruko386
Haruko386 marked this pull request as ready for review July 3, 2026 06:02
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a userID parameter to MemoryDAO.GetByFilter, applying a SQL condition restricting results to matching tenant or team-level permissions. MemoryService.ListMemories now includes userID in the tenant ID list and passes it to GetByFilter. A router comment was also simplified.

Changes

Memory Access Filtering

Layer / File(s) Summary
DAO filter contract and SQL predicate
internal/dao/memory.go
GetByFilter gains a leading userID parameter and appends a (m.tenant_id = ? OR m.permissions = ?) condition (with "team") when userID is non-empty, in both count and paginated queries.
Service tenant list and call site update
internal/service/memory.go
ListMemories now seeds the empty tenantIDs list with userID before appending related tenant IDs, and calls GetByFilter with userID as the first argument.
Router comment cleanup
internal/router/router.go
Simplifies the comment preceding the MCP server route group with no behavioral change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant MemoryService
    participant MemoryDAO
    participant Database

    Client->>MemoryService: ListMemories(userID, tenantIDs...)
    alt tenantIDs empty
        MemoryService->>MemoryService: build tenantIDs = [userID, ...userTenants]
    end
    MemoryService->>MemoryDAO: GetByFilter(userID, tenantIDs, ...)
    alt userID non-empty
        MemoryDAO->>Database: query with (tenant_id = ? OR permissions = 'team')
    else
        MemoryDAO->>Database: query without access predicate
    end
    Database-->>MemoryDAO: filtered memory rows
    MemoryDAO-->>MemoryService: memories, count
    MemoryService-->>Client: memory list
Loading

Suggested reviewers: yuzhichang

Poem

A rabbit hops through query and gate,
Checking tenants and team-shared state. 🐰
One more ID passed along the way,
Filters tighter, come what may.
Thump-thump — the memory list is safe today!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: expanding memory retrieval for team permissions.
Description check ✅ Passed The description includes the required Summary section and visual bug/fix context, though the written summary is minimal.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@JinHai-CN
JinHai-CN merged commit 488574f into infiniflow:main Jul 3, 2026
3 checks passed
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 3, 2026
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 6, 2026
@Haruko386
Haruko386 deleted the mutex branch July 14, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants