Skip to content

Commit

Permalink
use admin to redact if the user isn't ours
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Oct 17, 2024
1 parent 9fcc140 commit b76981b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion synapse/handlers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def __init__(self, hs: "HomeServer"):
self._redact_all_events, REDACT_ALL_EVENTS_ACTION_NAME
)

self.hs = hs

async def get_redact_task(self, redact_id: str) -> Optional[ScheduledTask]:
"""Get the current status of an active redaction process
Expand Down Expand Up @@ -423,8 +425,10 @@ async def _redact_all_events(
user_id = task.params.get("user_id")
assert user_id is not None

# puppet the user if they're ours, otherwise use admin to redact
requester = create_requester(
user_id, authenticated_entity=admin.user.to_string()
user_id if self.hs.is_mine_id(user_id) else admin.user.to_string(),
authenticated_entity=admin.user.to_string(),
)

reason = task.params.get("reason")
Expand Down

0 comments on commit b76981b

Please sign in to comment.