Skip to content

feat(access): add SUPER_ADMIN platform role support#304

Merged
dongmucat merged 6 commits intomainfrom
feat/oss-02-super-admin-visibility
Apr 14, 2026
Merged

feat(access): add SUPER_ADMIN platform role support#304
dongmucat merged 6 commits intomainfrom
feat/oss-02-super-admin-visibility

Conversation

@XiaoSeS
Copy link
Copy Markdown
Collaborator

@XiaoSeS XiaoSeS commented Apr 14, 2026

Summary

Add SUPER_ADMIN platform role support for unrestricted skill access across all visibility levels and publication states.

Changes

Backend:

  • Add platformRoles parameter to VisibilityChecker.canAccess() for platform-level access control
  • SUPER_ADMIN can access all skills regardless of visibility or publication status
  • Add archived namespace check to SkillQueryService.getSkillDetail()
  • Extract platformRoles from AuthContext in SkillController

Tests:

  • Replace VisibilityChecker mock with real instance in SkillQueryServiceTest (eliminates mock stubbing complexity)
  • Add 5 new tests for SUPER_ADMIN access scenarios in VisibilityCheckerTest
  • Fix test data ownership issues revealed by real VisibilityChecker

Frontend:

  • Add version-status-badge.tsx component for skill version status display

Test Results

  • Domain layer: 347 tests passing
  • App layer: 16 tests passing

Related

Part of OSS-02 core semantic rules implementation.

XiaoSeS added 4 commits April 13, 2026 09:26
## Summary
- Add UPLOADED status for PRIVATE skills after security scan passes
- PRIVATE skill owners can test before confirming publish or submitting for review
- Rerelease now follows visibility rules (PRIVATE→UPLOADED, PUBLIC→PENDING_REVIEW)
- Auto-withdraw changes status to UPLOADED (not DRAFT) to keep versions visible

## Changes
- SkillVersionStatus: Add UPLOADED enum value
- SkillPublishService: PRIVATE skills go to UPLOADED after scan
- SecurityScanService: Visibility-based status transition after scan
- SkillGovernanceService: Withdraw→UPLOADED, delete allows UPLOADED
- SkillQueryService: Include UPLOADED in version list filters
- SkillReviewSubmitService: New service for submit-review and confirm-publish
- SkillLifecycleController: Add submit-review and confirm-publish endpoints
- Frontend: Add buttons, dialogs, and hooks for new operations

## Workflow
- PRIVATE: Publish → SCANNING → UPLOADED → confirm-publish → PUBLISHED
- PUBLIC: Publish → SCANNING → PENDING_REVIEW → PUBLISHED
Support both DRAFT (legacy) and UPLOADED (new flow) status in:
- SkillReviewSubmitService.submitForReview
- SkillReviewSubmitService.confirmPublish
- ReviewService.submitReview (both overloads)

This ensures existing data with DRAFT status continues to work
with the new visibility-based workflow introduced in OSS-02.
…status-semantic

# Conflicts:
#	README.md
#	README_zh.md
- Add platformRoles parameter to VisibilityChecker.canAccess() for platform-level access control
- SUPER_ADMIN can access all skills regardless of visibility or publication status
- Add archived namespace check to SkillQueryService.getSkillDetail()
- Extract platformRoles from AuthContext in SkillController
- Replace VisibilityChecker mock with real instance in SkillQueryServiceTest
- Add 5 new tests for SUPER_ADMIN access scenarios
- Add version-status-badge.tsx component for frontend status display

Tests: 347 domain tests + 16 app tests passing
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Collaborator

@dongmucat dongmucat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 高风险:SUPER_ADMIN 权限只打通了 skill detail,没有打通其余读取主链路,和这个 PR 的目标不一致。现在只有 getSkillDetail() 传入了 platformRoles 并走了新判定,但 listVersionsgetVersionDetaillistFilesresolveVersion 以及下载链路仍然只按 userId/userNsRoles 走旧权限逻辑。

相关位置:

  • server/skillhub-app/src/main/java/com/iflytek/skillhub/controller/portal/SkillController.java
  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillQueryService.java
  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillDownloadService.java

这会导致超级管理员出现“详情页能看,但版本列表/文件预览/解析/下载仍受限”的半生效状态,属于功能级不一致。建议把 platformRoles 沿所有 read/download 链路继续透传,并补齐对应测试。

  1. 中风险:getSkillDetail() 放行了 SUPER_ADMIN,但生命周期投影仍按 owner / namespace admin 计算,导致详情页返回的数据语义不一致。

相关位置:

  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillQueryService.java
  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillLifecycleProjectionService.java

目前 canManageLifecycle() 已经会对 SUPER_ADMIN 返回 true,但 headlineVersion / ownerPreviewVersion / resolutionMode 还是按普通 viewer 逻辑算,未发布 skill 上会出现“有管理权限但看不到对应预览版本”的错位。建议让 lifecycle projection 也识别 SUPER_ADMIN,否则前端展示和权限标记会互相打架。

XiaoSeS added 2 commits April 14, 2026 15:49
…d SCAN_FAILED

The error message for unsupported version deletion still referenced only
DRAFT/REJECTED. Updated both EN and ZH messages to reflect the actual
deletable statuses: DRAFT, UPLOADED, REJECTED, SCAN_FAILED.

Also updated OSS-02 design doc to mark all blocking items as completed.
@XiaoSeS
Copy link
Copy Markdown
Collaborator Author

XiaoSeS commented Apr 14, 2026

  1. 高风险:SUPER_ADMIN 权限只打通了 skill detail,没有打通其余读取主链路,和这个 PR 的目标不一致。现在只有 getSkillDetail() 传入了 platformRoles 并走了新判定,但 listVersionsgetVersionDetaillistFilesresolveVersion 以及下载链路仍然只按 userId/userNsRoles 走旧权限逻辑。

相关位置:

  • server/skillhub-app/src/main/java/com/iflytek/skillhub/controller/portal/SkillController.java
  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillQueryService.java
  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillDownloadService.java

这会导致超级管理员出现“详情页能看,但版本列表/文件预览/解析/下载仍受限”的半生效状态,属于功能级不一致。建议把 platformRoles 沿所有 read/download 链路继续透传,并补齐对应测试。

  1. 中风险:getSkillDetail() 放行了 SUPER_ADMIN,但生命周期投影仍按 owner / namespace admin 计算,导致详情页返回的数据语义不一致。

相关位置:

  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillQueryService.java
  • server/skillhub-domain/src/main/java/com/iflytek/skillhub/domain/skill/service/SkillLifecycleProjectionService.java

目前 canManageLifecycle() 已经会对 SUPER_ADMIN 返回 true,但 headlineVersion / ownerPreviewVersion / resolutionMode 还是按普通 viewer 逻辑算,未发布 skill 上会出现“有管理权限但看不到对应预览版本”的错位。建议让 lifecycle projection 也识别 SUPER_ADMIN,否则前端展示和权限标记会互相打架。

变更说明

本次调整回收了 portal 侧已经引入的 SUPER_ADMIN 读取特权,恢复 portal 页面始终面向普通 viewer 的权限语义,不再让超级 管理员在 skill detail 页获得额外的可见性或生命周期管理视图。

本次修改

  • 移除 portal getSkillDetailplatformRoles 的依赖
  • 回退 SkillQueryService#getSkillDetail 中针对 SUPER_ADMIN 的 detail 放行逻辑
  • 保持 portal 详情页、生命周期投影、交互标记继续按普通 viewer 规则返回
  • 补充回归测试,覆盖:
    • SUPER_ADMIN 不会在 portal detail 中获得额外 lifecycle 权限
    • SUPER_ADMIN 不会在 portal detail 中绕过 private skill 可见性

设计取舍

不继续把 SUPER_ADMIN 能力沿 portal read/download 主链路打通。 portal 保持用户态语义一致,超级管理员的额外读取/下载能力后续单独在 admin 页面规划和承载。

验证

已通过:

  • mvn -pl skillhub-domain -Dtest=SkillQueryServiceTest test

说明:

  • skillhub-app 模块当前存在分支内既有编译问题,与本次 portal 权限回退无关,因此未完成 app 模块测试。

@dongmucat dongmucat merged commit 5d87a0c into main Apr 14, 2026
3 of 4 checks passed
Rsweater pushed a commit to Rsweater/skillhub that referenced this pull request Apr 16, 2026
…isibility

feat(access): add SUPER_ADMIN platform role support
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.

3 participants