Coverage for polar/file/auth.py: 100%
9 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 12:42 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 12:42 +0000
1from typing import Annotated
3from fastapi.params import Depends
5from polar.auth.dependencies import Authenticator
6from polar.auth.models import AuthSubject, Organization, User
7from polar.auth.scope import Scope
9_FileRead = Authenticator(
10 required_scopes={
11 Scope.web_read,
12 Scope.web_write,
13 Scope.files_write,
14 Scope.files_read,
15 },
16 allowed_subjects={User, Organization},
17)
18FileRead = Annotated[AuthSubject[User | Organization], Depends(_FileRead)]
20_FileWrite = Authenticator(
21 required_scopes={
22 Scope.web_write,
23 Scope.files_write,
24 },
25 allowed_subjects={User, Organization},
26)
27FileWrite = Annotated[AuthSubject[User | Organization], Depends(_FileWrite)]