Skip to content

feat(middleware): add key co-creator permission validation middleware (#1156) - #1206

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
Samuel-21-eng:main
Oct 23, 2026
Merged

Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
Samuel-21-eng:main

Conversation

@Samuel-21-eng

Copy link
Copy Markdown
Contributor

Completed the implementation of the co-creator permission validation middleware and comprehensive unit tests,
fully verifying all acceptance criteria (#1156).

✦Summary of Implementation

  • Middleware Layer: Built requireCoCreatorPermission in src/middlewares/co-creator-permission.middleware.ts to
    intercept creator-action endpoints and validate co-creator permissions.
  • Role Enforcement & Mapping:
    • ADMIN role passes all creator-action endpoints.
    • CONTENT role is restricted to announcement/post endpoints (CONTENT required).
    • REVENUE role is restricted to revenue/royalty/fee endpoints (REVENUE required).
  • Cache & On-Chain Registry: Leveraged getCoCreatorDetail (backed by the 60s Redis cache and Prisma key_cocreators
    table) to fetch co-creator roles.
  • Primary Creator Bypass: Automatically checks and bypasses co-creator validation when the caller's wallet is
    verified as the primary creator via checkCreatorProfileOwnership.
  • 403 Response Shape: Returns HTTP 403 containing both role_required and current_role when access is denied.
  • Testing: Added comprehensive unit tests in src/middlewares/co-creator-permission.middleware.test.ts verifying all.

closes #1156

@Chucks1093

Copy link
Copy Markdown
Member

✅ PR Ready for Review

Due to a recent malware incident affecting our repositories, all PRs are required to pass automated security checks before being reviewed for merging.

This PR has passed all automated checks:

  • ✅ Security scan — no malicious code detected
  • ✅ No merge conflicts
  • ✅ CI checks passed

Next step: Please share this PR link in our Telegram group so a maintainer can review and merge it: https://t.me/c/accesslayerorg/8514

@Chucks1093
Chucks1093 merged commit 30bb502 into accesslayerorg:main Oct 23, 2026
2 checks passed
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.

Add key co-creator permission validation middleware

2 participants