Coverage for src/lexigram/auth/authz/__init__.py: 67%

12 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-25 12:26 +0800

1"""Authorization (AuthZ) - Permissions and access control""" 

2 

3from __future__ import annotations 

4 

5from typing import Any 

6 

7from lexigram.auth.authz.guards import ( 

8 AuthorizationGuard, 

9 RouteGuard, 

10 optional_auth, 

11 require_auth, 

12 require_permissions, 

13 require_roles, 

14) 

15from lexigram.auth.authz.scopes import OAuthScope, ScopeManager 

16from lexigram.auth.authz.service import AuthorizationService 

17 

18 

19def __getattr__(name: str) -> Any: 

20 if name == "scope_manager": 

21 raise AttributeError( 

22 "scope_manager is now async. Use: await _get_scope_manager()", 

23 ) 

24 raise AttributeError(f"module {__name__} has no attribute {name}") 

25 

26 

27def __dir__() -> list[str]: 

28 return sorted(__all__) 

29 

30 

31__all__ = [ 

32 "AuthorizationGuard", 

33 "AuthorizationService", 

34 "OAuthScope", 

35 "RouteGuard", 

36 "ScopeManager", 

37 "optional_auth", 

38 "require_auth", 

39 "require_permissions", 

40 "require_roles", 

41 "scope_manager", 

42]