Loading src/portal_service/domain/models.py +2 −5 Changes for src/portal_service/domain/models.py: 2 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ from pydantic import BaseModel class Role(StrEnum): APP_PROVIDER = "app-provider" PLATFORM_OPERATOR = "platform-operator" OPERATOR = "operator" PLATFORM_ADMIN = "platform-admin" Loading Loading @@ -47,7 +47,4 @@ class TokenClaims(BaseModel): @property def is_human(self) -> bool: """True when the token belongs to a human user (not a service account).""" return any( r in self.roles for r in (Role.APP_PROVIDER, Role.PLATFORM_OPERATOR, Role.PLATFORM_ADMIN) ) return any(r in self.roles for r in (Role.APP_PROVIDER, Role.OPERATOR, Role.PLATFORM_ADMIN)) tests/integration/__init__.py 0 → 100644 +0 −0 Empty file added. tests/test_auth_deps.py +1 −1 Changes for tests/test_auth_deps.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ def test_require_any_role_sufficient_passes() -> None: def test_require_any_role_accepts_either_role() -> None: admin = TokenClaims(sub="s", iss="i", exp=1, iat=0, realm_access={"roles": ["platform-admin"]}) dep = auth_module.require_any_role(Role.PLATFORM_OPERATOR, Role.PLATFORM_ADMIN) dep = auth_module.require_any_role(Role.OPERATOR, Role.PLATFORM_ADMIN) assert _run_guard(dep, user=admin, auth_settings=JWT) is admin Loading Loading
src/portal_service/domain/models.py +2 −5 Changes for src/portal_service/domain/models.py: 2 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ from pydantic import BaseModel class Role(StrEnum): APP_PROVIDER = "app-provider" PLATFORM_OPERATOR = "platform-operator" OPERATOR = "operator" PLATFORM_ADMIN = "platform-admin" Loading Loading @@ -47,7 +47,4 @@ class TokenClaims(BaseModel): @property def is_human(self) -> bool: """True when the token belongs to a human user (not a service account).""" return any( r in self.roles for r in (Role.APP_PROVIDER, Role.PLATFORM_OPERATOR, Role.PLATFORM_ADMIN) ) return any(r in self.roles for r in (Role.APP_PROVIDER, Role.OPERATOR, Role.PLATFORM_ADMIN))
tests/test_auth_deps.py +1 −1 Changes for tests/test_auth_deps.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ def test_require_any_role_sufficient_passes() -> None: def test_require_any_role_accepts_either_role() -> None: admin = TokenClaims(sub="s", iss="i", exp=1, iat=0, realm_access={"roles": ["platform-admin"]}) dep = auth_module.require_any_role(Role.PLATFORM_OPERATOR, Role.PLATFORM_ADMIN) dep = auth_module.require_any_role(Role.OPERATOR, Role.PLATFORM_ADMIN) assert _run_guard(dep, user=admin, auth_settings=JWT) is admin Loading