Commit b043ed8
feat: use server-side permissions for View As UI gating
Use the existing GetProjectWithBearerToken pattern to fetch the
impersonated user's projectPermissions from the server, rather than
reconstructing permissions client-side.
Changes:
- Project layout calls GetProjectWithBearerToken with the mocked user's
JWT (from GetDeploymentCredentials) to get their actual permissions
- Created effectivePermissionsStore to share permissions with TopNavBar
- ProjectTabs uses effectiveProjectPermissions (impersonated user's
permissions when View As is active)
- TopNavigationBar uses effective permissions for Share button visibility
This follows the existing architecture where the server is the single
source of truth for permissions, rather than duplicating permission
logic on the client.
Co-authored-by: ericokuma <ericokuma@users.noreply.github.com>1 parent 3fc0678 commit b043ed8
3 files changed
Lines changed: 60 additions & 3 deletions
File tree
- web-admin/src
- features
- view-as-user
- routes/[organization]/[project]
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
| |||
231 | 241 | | |
232 | 242 | | |
233 | 243 | | |
234 | | - | |
| 244 | + | |
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
| |||
264 | 274 | | |
265 | 275 | | |
266 | 276 | | |
267 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
268 | 280 | | |
269 | 281 | | |
270 | 282 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
125 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
126 | 161 | | |
127 | 162 | | |
128 | 163 | | |
| |||
168 | 203 | | |
169 | 204 | | |
170 | 205 | | |
171 | | - | |
| 206 | + | |
172 | 207 | | |
173 | 208 | | |
174 | 209 | | |
| |||
0 commit comments