From 3131821afc9a28094bda359b3b8b5282d2e1e8f1 Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Fri, 4 Dec 2026 14:57:42 +0100 Subject: [PATCH] Expose customer impersonation in the operator workspace --- docs/development.md | 26 +++-- docs/panel-design.md | 6 ++ .../hosting/account_administration.py | 8 +- src/coulobre/hosting/impersonation.py | 3 +- src/coulobre/hosting/static/hosting/panel.css | 9 +- .../hosting/templates/hosting/all_users.html | 10 +- .../hosting/templates/hosting/base.html | 25 +++-- .../templates/hosting/customer_list.html | 13 ++- .../hosting/customer_preview_restricted.html | 12 ++- src/coulobre/hosting/test_impersonation.py | 101 +++++++++++++++++- src/coulobre/hosting/views.py | 2 +- 11 files changed, 173 insertions(+), 42 deletions(-) diff --git a/docs/development.md b/docs/development.md index 032285c..5bd207a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -109,12 +109,13 @@ requires password confirmation for each reveal. ## View the panel as a customer -In **Customers**, select **View as customer** next to an active customer. -The panel shows the customer's assigned hosting accounts and resource pages. -Request forms are visible with their inputs disabled. The banner identifies -the customer and offers **End customer view**. Ending the view returns you -to your administrator account. Signing out ends the view and signs you out -of the panel. +In the operator workspace, open **Show All Users** and select **Sign in as +customer** next to an eligible customer. The panel shows the customer's +assigned hosting accounts and supported resource pages. Request forms are +visible with their inputs disabled. The banner identifies the customer and +the session mode. Select **Leave impersonation** below the sidebar account +name, in place of the workspace switcher, to return to **All users** without +signing out. Signing out ends both sessions. A support session lasts up to 30 minutes and applies to the current browser session. The panel checks that both users remain eligible on each request. @@ -123,16 +124,21 @@ permission ends the view on the next request. A staff user needs both **Can view customer** and **Can view the panel as a customer**. The second permission is listed under **Customer impersonation -sessions**. In `/admin/`, users with **Can view customer impersonation +sessions**. Manager and Customer workspaces cannot start impersonation. +Managers can use **Manage hosting** and **Contact and invitation** in +**My users** for their assigned customers without changing identity. +In `/admin/`, users with **Can view customer impersonation session** can review the administrator, customer, timestamps, and outcome for each session. The audit records are read-only in Django admin. ### Make changes during a support session Grant **Can start a support session with write access** in addition to the -two customer view permissions. Select **Support with write access** next -to the customer. The banner identifies the active customer, administrator, -and mode. +two customer view permissions. In the operator workspace, open the legacy +customer list at `/customers/` and select **Support with write access** +next to the customer. The banner identifies the active customer, +administrator, and mode. **Sign in as customer** in **All users** still +starts a read-only session. In a writable session, the administrator can request a database or mailbox and manage SSH keys on the customer's hosting accounts. Each action also diff --git a/docs/panel-design.md b/docs/panel-design.md index ccba31e..2957ec0 100644 --- a/docs/panel-design.md +++ b/docs/panel-design.md @@ -103,6 +103,12 @@ heading, help, fields, and actions should share a left edge. action that opens a form, confirmation page, or download is still an `` styled as a button. An action that submits the change uses a native `