Commit 743b726
authored
Move backend user authorization guards to the actual write events (#1503)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
RelationController's pivot handlers save every model returned by prepareModelsToSave(). That list always includes the related model — FormModelSaver::setModelAttributes() pushes it before it even looks at $saveData — so a submission containing nothing but pivot data still saves the related record.
For a belongsToMany relation to Backend\Models\User, that no-op save fired User::beforeSave(), which throws for any operator lacking backend.manage_users. The relation became unusable for them. This is a regression against 1.2.9, surfaced by the user authorization guards added since.
Fixes #14641 parent 6164251 commit 743b726
5 files changed
Lines changed: 571 additions & 15 deletions
File tree
- modules/backend
- behaviors
- models
- tests
- behaviors
- fixtures/models
- models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1583 | 1583 | | |
1584 | 1584 | | |
1585 | 1585 | | |
1586 | | - | |
1587 | 1586 | | |
1588 | 1587 | | |
1589 | 1588 | | |
1590 | | - | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
1594 | 1598 | | |
1595 | 1599 | | |
1596 | 1600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
81 | 107 | | |
82 | 108 | | |
83 | 109 | | |
| |||
156 | 182 | | |
157 | 183 | | |
158 | 184 | | |
159 | | - | |
| 185 | + | |
160 | 186 | | |
161 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
162 | 212 | | |
163 | 213 | | |
164 | 214 | | |
| |||
176 | 226 | | |
177 | 227 | | |
178 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
179 | 258 | | |
180 | 259 | | |
181 | 260 | | |
| |||
0 commit comments