Skip to content

feat(bridge): add admin impersonation functionality#63

Merged
mrazza merged 2 commits into
mainfrom
feat/admin-impersonation
Jun 26, 2026
Merged

feat(bridge): add admin impersonation functionality#63
mrazza merged 2 commits into
mainfrom
feat/admin-impersonation

Conversation

@oca-agent

Copy link
Copy Markdown
Collaborator

This PR adds the admin impersonation feature to goose-mm-bridge.

Changes:

  • Config: Added the ADMIN_USERS parameter parsed from environment variables (comma-separated usernames or user IDs). Supports overrides via user-specific .env configurations.
  • Mattermost Bridge:
    • Maintained self.impersonations in-memory dictionary.
    • Added the !impersonate <target> command to impersonate another user (by ID or username via automated search).
    • Supported clearing active impersonations with !impersonate clear, !impersonate off, or !impersonate stop.
    • Blocked non-administrators from triggering the command.
    • Handled incoming prompts, !stop, and !context actions under the context of the impersonated user's session key, user mapping, and metadata.
  • Testing:
    • Added unit tests for parsing ADMIN_USERS in test_config.py.
    • Added comprehensive unit tests in test_mattermost_bridge.py covering permission denial, user search/resolution, target lookup failure, bot impersonation prevention, successful impersonation session flow, stop, and context actions.

Reviewer: @mrazza

- Add ADMIN_USERS configuration option
- Implement the !impersonate command allowing administrators to operate as other users
- Resolve target users by username or user ID
- Support clearing impersonations with '!impersonate clear/off/stop'
- Direct sessions, !stop, and !context commands to the impersonated user's context
- Add robust configuration and bridge unit tests
@oca-agent
oca-agent requested a review from mrazza June 26, 2026 03:05
@mrazza
mrazza merged commit e937f13 into main Jun 26, 2026
1 check passed
@mrazza
mrazza deleted the feat/admin-impersonation branch June 26, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants