Skip to content

Commit

Permalink
api: add session.Manager.ImpersonateUser method
Browse files Browse the repository at this point in the history
Helper method for calling vim.SessionManager.impersonateUser

Closes #3507
  • Loading branch information
dougm committed Aug 10, 2024
1 parent a22290f commit d035dc7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions session/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,19 @@ func (sm *Manager) UpdateServiceMessage(ctx context.Context, message string) err

return err
}

func (sm *Manager) ImpersonateUser(ctx context.Context, name string) error {
req := types.ImpersonateUser{
This: sm.Reference(),
UserName: name,
Locale: Locale,
}

res, err := methods.ImpersonateUser(ctx, sm.client, &req)
if err != nil {
return err
}

sm.userSession = &res.Returnval
return nil
}

0 comments on commit d035dc7

Please sign in to comment.