Skip to content

Use backend access checks for gated content #14

Description

@Lakes41

Summary

Refactor gated content decisions so they can use the backend access policy engine instead of relying only on client-side tier and role checks.

Current Behaviour

components/gated.tsx locally compares roles, membership tier, and membership active status. This duplicates policy logic in the frontend and may diverge from guildpass-core.

Expected Behaviour

The frontend should ask the access API whether the connected wallet can access a resource, then render allowed, denied, loading, or error states from that decision.

Suggested Implementation

Extend AccessApi with a checkAccess(resourceId, address) method. Implement it in mock and live clients. Update gated pages to pass a resource identifier instead of hard-coded tier logic where practical.

Files or Areas Likely Affected

  • components/gated.tsx
  • app/resources/alpha/page.tsx
  • app/events/demo/page.tsx
  • lib/api/types.ts
  • lib/api/live.ts
  • lib/api/mock.ts

Acceptance Criteria

  • AccessApi exposes a typed access check method
  • LiveAccessApi calls the backend access check endpoint
  • MockAccessApi simulates allow and deny decisions consistently
  • Gated pages render based on backend-style access decisions
  • Denied states include a safe reason message
  • Existing tier and role props are either mapped or deprecated cleanly

Additional Notes

Assumption: guildpass-core exposes or will expose a resource access decision endpoint. If not, document the expected contract before implementing the live client.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions