Commit cb03445
committed
UN-3586 [FIX] Move rotate self-check to has_object_permission (PR review)
Relocate the 'key may rotate only its own key' constraint from has_permission
(view-level, via view.kwargs[pk]) to has_object_permission, the idiomatic DRF
location for per-object access control — it receives the already-fetched obj.
has_permission stays as the coarse session-vs-key gate. Behavior is unchanged
(self-rotate 200, cross-key 403): this permission is only used by the rotate
detail action, which calls get_object() and so always triggers the
object-level check. (Greptile)1 parent baf9415 commit cb03445
1 file changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
53 | 59 | | |
54 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
0 commit comments