Coverage for polar/organization/auth.py: 100%
10 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 17:15 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 17:15 +0000
1from typing import Annotated 1a
3from fastapi import Depends 1a
5from polar.auth.dependencies import Authenticator 1a
6from polar.auth.models import Anonymous, AuthSubject, Organization, User 1a
7from polar.auth.scope import Scope 1a
9OrganizationsRead = Annotated[ 1a
10 AuthSubject[User | Organization],
11 Depends(
12 Authenticator(
13 required_scopes={
14 Scope.web_read,
15 Scope.web_write,
16 Scope.organizations_read,
17 Scope.organizations_write,
18 },
19 allowed_subjects={User, Organization},
20 )
21 ),
22]
24OrganizationsWrite = Annotated[ 1a
25 AuthSubject[User | Organization],
26 Depends(
27 Authenticator(
28 required_scopes={
29 Scope.web_write,
30 Scope.organizations_write,
31 },
32 allowed_subjects={User, Organization},
33 )
34 ),
35]
37OrganizationsCreate = Annotated[ 1a
38 AuthSubject[User],
39 Depends(
40 Authenticator(
41 required_scopes={
42 Scope.web_write,
43 Scope.organizations_write,
44 },
45 allowed_subjects={User},
46 )
47 ),
48]
50OrganizationsWriteUser = Annotated[ 1a
51 AuthSubject[User],
52 Depends(
53 Authenticator(
54 required_scopes={
55 Scope.web_write,
56 Scope.organizations_write,
57 },
58 allowed_subjects={User},
59 )
60 ),
61]
63OrganizationsReadOrAnonymous = Annotated[ 1a
64 AuthSubject[User | Organization | Anonymous],
65 Depends(
66 Authenticator(
67 required_scopes=set(), # No required scopes for this authenticator
68 allowed_subjects={User, Organization, Anonymous},
69 )
70 ),
71]