Skip to content

v0.2.0

Choose a tag to compare

@ericmiguel ericmiguel released this 08 Apr 16:54
· 17 commits to main since this release

πŸš€ Features

  • AreasBase: declare business areas as typed class attributes; Area objects
    are instantiated automatically on __init__ β€” no more dict-based access
  • ADMIN = 2 permission level added; satisfies READ and WRITE requirements
  • Area now exposes READ, WRITE, and ADMIN AccessRule attributes
  • TokenBearer: canonical name for the cookie-with-header-fallback bearer

🚜 Refactor

  • (bearers) FallbackTokenBearer renamed to TokenBearer; old name kept as
    a deprecated alias via __getattr__
  • (rules) Scope renamed to Area; make_scopes/make_scope renamed to
    make_areas/make_area; old names kept as deprecated aliases
  • (rules) DENY = -1 removed β€” it was reserved but never implemented; use
    PermissionDeniedException to block access unconditionally
  • (rules) make_areas() and make_area() are now deprecated in favour of
    AreasBase; both emit DeprecationWarning at call time

πŸ“š Documentation

  • Full API reference rewrite covering AreasBase, Area, AccessRule,
    ADMIN, all bearers, ProtectedRouter, JWT utilities, and exceptions
  • index.md: end-to-end example, permission hierarchy table, compatibility
    requirements, and improved cookie/header token sending guide
  • rules.md: migration guide (make_areas β†’ AreasBase, make_area β†’ Area)
    with before/after tabs and danger admonitions on deprecated sections
  • bearers.md: bearer comparison table, token revocation hook example,
    JWTClaims subclassing guide
  • routers.md: ProtectedRouter router-level vs endpoint-level rules table
  • README.md: full rewrite with current API, AreasBase, and ADMIN example
  • mkdocs.yaml: enable pymdownx.tabbed so === tab blocks render correctly

πŸ§ͺ Testing

  • TestAreasBase: 4 tests covering field creation, name matching,
    AccessRule instantiation, and non-Area annotation filtering
  • make_area/make_areas tests now assert DeprecationWarning is emitted
  • test_admin_access: new parametrised test for /finances/admin and
    /finances/admin/router endpoints
  • test_write_access: updated to expect HTTP 200 β€” the sample token now
    carries ADMIN level, which satisfies WRITE

βš™οΈ Miscellaneous Tasks

  • Bump version to 0.2.0
  • Sample app migrated to AreasBase with finances: ADMIN token and
    /finances/admin + finances_admin_router endpoints