Opened 9 years ago

Last modified 10 hours ago

#27489 assigned Bug

Renaming a model doesn't rename the permission name and codename

Reported by: Tim Graham Owned by: Artyom Kotovskiy
Component: contrib.auth Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

After a RenameModel operation, new permissions are created with the name and codename of the new model name rather than renaming the permissions with the old model name. It should be feasible to fix by using an approach similar to f179113e6cbc8ba0a8d4e87e1d4410fb61d63e75 where a RenamePermission operation is injected in the plan after each RenameModel operation.

#26756 requires the same approach except that the RenamePermission operation must be inserted after AlterModelOptions operations with a verbose_name key.

Change History (32)

comment:1 by Morgan Aubert, 9 years ago

Owner: changed from nobody to Morgan Aubert
Status: newassigned

comment:2 by Morgan Aubert, 9 years ago

Added PR

comment:3 by Simon Charette, 9 years ago

Has patch: set
Version: 1.10master

comment:4 by Tim Graham, 9 years ago

Patch needs improvement: set

I left comments for improvement on the patch.

comment:5 by Mariusz Felisiak, 5 years ago

Owner: Morgan Aubert removed
Status: assignednew

comment:6 by Natalia Bidart, 2 years ago

Duplicates of this are #32715 and #34762.

comment:7 by Artyom Kotovskiy, 9 months ago

Owner: set to Artyom Kotovskiy
Status: newassigned

comment:9 by Tim Graham, 9 months ago

Patch needs improvement: unset

Don't forget to update the ticket's flags so the ticket appears in the review queue.

comment:10 by Sarah Boyce, 8 months ago

Needs tests: set

comment:11 by Artyom Kotovskiy, 8 months ago

Needs tests: unset

comment:12 by Sarah Boyce, 7 months ago

Patch needs improvement: set

comment:13 by Artyom Kotovskiy, 6 months ago

Patch needs improvement: unset

comment:14 by Sarah Boyce, 6 months ago

Patch needs improvement: set

comment:15 by Artyom Kotovskiy, 6 months ago

Patch needs improvement: unset

comment:16 by Sarah Boyce, 6 months ago

Patch needs improvement: set

comment:17 by Artyom Kotovskiy, 6 months ago

Patch needs improvement: unset

comment:18 by Sarah Boyce, 5 months ago

Needs tests: set

comment:19 by Artyom Kotovskiy, 5 months ago

Needs tests: unset

comment:20 by Sarah Boyce, 5 months ago

Triage Stage: AcceptedReady for checkin

comment:21 by Sarah Boyce <42296566+sarahboyce@…>, 5 months ago

Resolution: fixed
Status: assignedclosed

In f02b49d:

Fixed #27489 -- Renamed permissions upon model renaming in migrations.

comment:22 by Mariusz Felisiak <felisiak.mariusz@…>, 4 months ago

In 6e89271a:

Refs #27489 -- Made RenamePermission() operation respect database.

Regression in f02b49d2f3bf84f5225de920ca510149f1f9f1da.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@…>

comment:23 by Natalia Bidart, 10 days ago

Has patch: unset
Triage Stage: Ready for checkinAccepted

comment:26 by Jacob Walls, 10 days ago

For context on why this was reverted, see #36843 and #36793. Also see some lower priority feedback left in inline comments in this draft PR.

comment:27 by Jacob Walls <jacobtylerwalls@…>, 10 days ago

Owner: set to Jacob Walls <jacobtylerwalls@…>
Resolution: fixed

In 030c63d3:

Fixed #36843, #36793 -- Reverted "Fixed #27489 -- Renamed permissions upon model renaming in migrations."

This reverts commits f02b49d2f3bf84f5225de920ca510149f1f9f1da and 6e89271a8507fe272d11814975500a1b40303a04.

comment:30 by Jacob Walls <jacobtylerwalls@…>, 10 days ago

Owner: set to Jacob Walls <jacobtylerwalls@…>
Resolution: fixed

In 42bab762:

[6.0.x] Fixed #36843, #36793 -- Reverted "Fixed #27489 -- Renamed permissions upon model renaming in migrations."

This reverts commits f02b49d2f3bf84f5225de920ca510149f1f9f1da and 6e89271a8507fe272d11814975500a1b40303a04.

Backport of 030c63d329c4814da221528e823a4aaaaa40e4f1 from main.

comment:31 by Jacob Walls, 10 days ago

Resolution: fixed
Status: closednew

comment:32 by Jacob Walls, 10 days ago

Owner: Jacob Walls <jacobtylerwalls@…> removed
Status: newassigned

comment:33 by Jacob Walls, 8 days ago

Asked on forum about conflict handling.

comment:34 by Artyom Kotovskiy, 16 hours ago

Owner: set to Artyom Kotovskiy

comment:36 by Artyom Kotovskiy, 10 hours ago

Has patch: set
Note: See TracTickets for help on using tickets.
Back to Top