Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / class

Principal

shared.auth.Principal

PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.

PHAROS at 975a38dMIT license

Around this symbol

Search all symbols

Loading

Called by (1)
SymbolFileResolved by
authauth.pysame file
Contains (3)
SymbolFileResolved by
as_stateauth.pysame file
is_adminauth.pysame file
user_uuidauth.pysame file
Inside (1)
SymbolFileResolved by
authauth.pysame file
shared.auth.Principalbackend/app/shared/auth.py, lines 69–90Open source
@dataclass(frozen=True)class Principal:    name: str    scopes: frozenset[str]    @property    def is_admin(self) -> bool:        return "admin" in self.scopes    @property    def user_uuid(self) -> uuid.UUID:        """Stable identifier for per-principal records (e.g. developer profiles)."""        return uuid.uuid5(uuid.NAMESPACE_URL, f"pharos:principal:{self.name}")    def as_state(self) -> dict:        # Shape kept for existing code that reads request.state.user.        return {            "user_id": str(self.user_uuid),            "username": self.name,            "scopes": sorted(self.scopes),            "tier": self.name,        }

What the index recorded

Signature
class Principal:
File
backend/app/shared/auth.py
Lines
69–90
Parser
python-ast
Git blob
c77f24b3d7406a6b302764a8fc5e475c40480e60
Call sites
1 named, 0 resolved, 1 left unlinked

Read it on GitHub at this commit