Commit 6d433ca
Matthew Fisher
fix(controller): disallow unauthorized users from deleting apps
Authenticated users who were not given explicit permission to view
or modify an application were still allowed to delete other user's
applications, should the unauthorized user know what the ID of the
application would be. This returns a 404 message if the user is
unauthorized to see the application.
Because we were calling get_object_or_404(), we were not performing
any authorization against the API call. Calling self.get_object() is
the preferred method to retrieve an object since it authenticates
against the classes' permissions classes to ensure that the user is
authorized to see the application.
This also fixes up an issue where administrators were not explicitly
given permission to an app. They fell through the same "unauthorized"
issue as above.1 parent b2e23ce commit 6d433ca
3 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
278 | 282 | | |
279 | 283 | | |
280 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
0 commit comments