Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ dependencies = [
"sentry-options>=1.2.15",
"sentry-protos>=0.91.0",
"sentry-redis-tools>=0.5.0",
"sentry-viewercontext>=0.1.0",
"sentry-viewercontext>=0.2.0",
"sentry-relay>=0.10.1",
"sentry-scm>=1.9.0",
"sentry-sdk[http2]>=2.72.0",
Expand Down
16 changes: 2 additions & 14 deletions src/sentry/viewer_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,8 @@


def get_acting_user_id(ctx: ViewerContext | None) -> int | None:
"""Return the human user *ctx* acts as, or ``None``.

A user actor acts as itself and an agent acts for its delegating user. Other
actor types never resolve to a user, so a stray ``delegated_user_id`` on them
cannot grant user identity.
"""
if ctx is None:
return None
actor = ctx.actor
if actor.type == ActorType.USER:
return actor.actor_id
if actor.type == ActorType.AGENT:
return actor.delegated_user_id
return None
"""Return the human user *ctx* acts as, or ``None``."""
return ctx.actor.user_id if ctx is not None else None


def observe_viewer_context_propagation(
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading