9c Phase 2 #6
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "develop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements flexible feature access control with 3-tier hierarchy: 1. User-specific restrictions (highest priority) 2. Tier limits 3. Feature defaults New functions: - get_effective_tier(profile_id) - Checks access_grants, falls back to profile.tier - check_feature_access(profile_id, feature_id) - Complete access check Returns: {allowed, limit, used, remaining, reason} - increment_feature_usage(profile_id, feature_id) - Usage tracking - _calculate_next_reset(reset_period) - Helper for daily/monthly resets Supports: - Boolean features (enabled/disabled) - Count-based features with limits - Automatic reset (daily/monthly/never) - Unlimited (NULL) and disabled (0) states Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>New router: routers/coupons.py Admin endpoints: - GET /api/coupons - List all coupons with stats - POST /api/coupons - Create new coupon - PUT /api/coupons/{id} - Update coupon - DELETE /api/coupons/{id} - Soft-delete (set active=false) - GET /api/coupons/{id}/redemptions - Redemption history User endpoints: - POST /api/coupons/redeem - Redeem coupon code Features: - Three coupon types: single_use, period, wellpass - Wellpass logic: Pauses existing personal grants, resumes after expiry - Max redemptions limit (NULL = unlimited) - Validity period checks - Activity logging - Duplicate redemption prevention Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Five new admin routers: 1. routers/features.py - GET/POST/PUT/DELETE /api/features - Feature registry CRUD - Allows adding new limitable features without schema changes 2. routers/tiers_mgmt.py - GET/POST/PUT/DELETE /api/tiers - Subscription tier management - Price configuration, sort order 3. routers/tier_limits.py - GET /api/tier-limits - Complete Tier x Feature matrix - PUT /api/tier-limits - Update single limit - PUT /api/tier-limits/batch - Batch update - DELETE /api/tier-limits - Remove limit (fallback to default) - Matrix editor backend 4. routers/user_restrictions.py - GET/POST/PUT/DELETE /api/user-restrictions - User-specific feature overrides - Highest priority in access hierarchy - Includes reason field for documentation 5. routers/access_grants.py - GET /api/access-grants - List grants with filters - POST /api/access-grants - Manual grant creation - PUT /api/access-grants/{id} - Extend/pause grants - DELETE /api/access-grants/{id} - Revoke access - Activity logging All endpoints require admin authentication. Completes backend API for v9c Phase 2. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>