Commit dcd20a7
committed
feat(webapp): impersonation consent page and a view-as-user toggle
Opening a `/@/orgs/<slug>/…` link from outside the dashboard (address bar,
bookmark, a link shared elsewhere) used to bounce back to /admin, because
starting impersonation requires a same-origin navigation. Keep that requirement
for the state change, but render a consent interstitial instead of blocking: the
page names the organization and destination, and its "Impersonate" button posts
back from our own page, so the same-origin check still holds. In-app admin links
are unchanged and still impersonate in one click.
Also add a display-only "View as user" toggle for impersonation sessions. It
lives on the impersonation cookie, so it disappears when impersonation is
cleared, and it hides admin-only UI both client-side (via useHasAdminAccess) and
in the loaders that compute what to show. It never touches authorization. The
escape hatches — the impersonation border, "Stop impersonating", the global
shortcut and the toggle itself — stay visible while it's on.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5rpYGm4SVqxSNXx6sXtpu1 parent 2f1734c commit dcd20a7
19 files changed
Lines changed: 671 additions & 128 deletions
File tree
- .server-changes
- apps/webapp
- app
- hooks
- models
- routes
- _app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboards.custom.$dashboardId
- _app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.playground
- _app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query
- _app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.regions
- _app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.test.tasks.$taskParam
- _app.orgs.$organizationSlug.projects.$projectParam.env.$envParam
- services
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
| |||
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| 43 | + | |
| 44 | + | |
36 | 45 | | |
37 | 46 | | |
38 | 47 | | |
| |||
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
72 | | - | |
| 81 | + | |
73 | 82 | | |
74 | 83 | | |
75 | 84 | | |
| |||
785 | 794 | | |
786 | 795 | | |
787 | 796 | | |
788 | | - | |
| 797 | + | |
789 | 798 | | |
790 | 799 | | |
791 | 800 | | |
| |||
813 | 822 | | |
814 | 823 | | |
815 | 824 | | |
816 | | - | |
| 825 | + | |
817 | 826 | | |
818 | 827 | | |
819 | 828 | | |
820 | 829 | | |
821 | | - | |
| 830 | + | |
822 | 831 | | |
823 | 832 | | |
824 | 833 | | |
| |||
1832 | 1841 | | |
1833 | 1842 | | |
1834 | 1843 | | |
1835 | | - | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
1836 | 1847 | | |
1837 | 1848 | | |
1838 | | - | |
1839 | | - | |
1840 | | - | |
1841 | | - | |
1842 | | - | |
1843 | | - | |
1844 | | - | |
1845 | | - | |
1846 | | - | |
1847 | | - | |
1848 | | - | |
1849 | | - | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
1853 | 1867 | | |
1854 | 1868 | | |
1855 | 1869 | | |
| |||
1906 | 1920 | | |
1907 | 1921 | | |
1908 | 1922 | | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
1909 | 1947 | | |
1910 | 1948 | | |
1911 | 1949 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| 49 | + | |
36 | 50 | | |
37 | | - | |
| 51 | + | |
38 | 52 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
| |||
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
227 | | - | |
| 228 | + | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| |||
Lines changed: 0 additions & 82 deletions
This file was deleted.
0 commit comments