Skip to main content
Entitlements let you control feature access based on both a user’s role and their organization’s subscription plan—including quota limits tied to paid tiers—making them ideal for managing access in tiered offerings.

Implementation

The core part of the entitlements logic is to conditionally grant a user permission based on a combination of their role and attributes of the organization. For example, we can grant users permission to create repositories for an organization if:
  • They have the “member” role for that organization, and
  • The organization has not reached their paid quota of repositories
To test this, we define:
  • Organizations with different subscription plans and quota usage.
  • Users assigned to each organization.
  • Assertions to verify which users can create repositories based on remaining quota.