Skip to content

修复creator报错和权限问题 - #52

Open
fighter2011 wants to merge 7 commits into
trueleaf:mainfrom
fighter2011:fix/import-children-creator
Open

fighter2011 wants to merge 7 commits into
trueleaf:mainfrom
fighter2011:fix/import-children-creator

Conversation

@fighter2011

Copy link
Copy Markdown

1、修复creator不存在,主要是多层级导入问题
2、用户组授权给项目时,该项目里的组快照是空数组(Mongoose 数组默认 [])→ 组内成员在这个项目里匹配不到 → 列表看不到、访问报 4002 暂无当前项目权限。只有"创建项目时就带上组"的那些项目是好的 → 表现为只有部分项目有权

…host)

The v0.9.4 fix (9b8e7d6) only normalized top-level docs and kept the
unknown 'prefix' field in item.url. Folder docs carry embedded children
(attached by previewNavTreeData), so nested imports failed validation:
- moyuData.docs[0].children[0].info.creator is not allowed to be empty
- moyuData.docs[0].children[0].item.url.prefix is not allowed

Normalize recursively: backfill creator from the current user and rename
item.url.prefix to host (dropping prefix) for every doc including children.

Fixes trueleaf#44 for nested (folder) imports
getDocDetail queried Mongo with an unchecked _id; frontend-restored tabs
can carry nanoid-style ids (e.g. left over from a failed import), which
threw a CastError and surfaced as code 5000 '内部错误'. Guard with
Types.ObjectId.isValid and raise the existing 4001 '暂无文档信息'.
doc_detail failures rejected with a plain Error, so callers could not
tell 'doc missing' (4001) apart from real failures; the stale tab was
restored and errored on every page load. Attach the business code to the
rejected error in the response interceptor, and in getDocById reuse the
existing close-tab confirmation when the server reports 4001.
…ization

The frontend node factory emits isDeleted (unknown to ImportedDocInfo)
and empty-string createdAt/updatedAt (rejected by RuleType.string()).
Drop them so nested and flat docs both pass validation; the server
generates timestamps itself.
…g project

Adding a user group to an existing project pushed only groupId/groupName
without the groupUsers snapshot, so every permission check that matches
against groups[].groupUsers failed for all members of that group. The
snapshot only got populated later as a side effect of re-syncing group
membership, which made the missing permissions look intermittent.

Also reject unknown groups and adding the same group twice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant