Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SET USER Keyword

Switch the current user context within a script execution.

Syntax

SET USER user_id

Parameters

ParameterTypeDescription
user_idString (UUID)The UUID of the user to switch to

Description

The SET USER keyword changes the active user context for subsequent operations in the script. This is useful for administrative scripts that need to perform actions on behalf of different users.

Example

' Admin script to update user preferences
SET USER "550e8400-e29b-41d4-a716-446655440000"
SET USER MEMORY "theme", "dark"
SET USER MEMORY "language", "pt-BR"

TALK "User preferences updated."

Example: Batch User Operations

' Process multiple users
users = GET "SELECT id FROM users WHERE needs_update = true"

FOR EACH user IN users
    SET USER user.id
    SET USER MEMORY "migrated", "true"
    SEND MAIL user.email, "Account Updated", "Your account has been migrated."
NEXT

Use Cases

  • Administrative batch operations
  • Multi-tenant management scripts
  • User impersonation for support
  • Scheduled maintenance tasks

Security

  • Requires admin privileges to execute
  • All actions are logged with original admin identity
  • Cannot escalate privileges beyond script permissions

See Also