修复creator报错和权限问题 - #52
Open
fighter2011 wants to merge 7 commits into
Open
fighter2011 wants to merge 7 commits into
fighter2011 wants to merge 7 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1、修复creator不存在,主要是多层级导入问题
2、用户组授权给项目时,该项目里的组快照是空数组(Mongoose 数组默认 [])→ 组内成员在这个项目里匹配不到 → 列表看不到、访问报 4002 暂无当前项目权限。只有"创建项目时就带上组"的那些项目是好的 → 表现为只有部分项目有权