Change ObjectPermission name to a required field #3935

Closed
opened 2025-12-29 18:32:09 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Aug 3, 2020).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Make the name field on the ObjectPermission field mandatory. (Currently, it is optional.)

Justification

Experimentation with v2.9-beta1 has shown that a hard-coded name is necessary to effectively manage object-based permissions. Initially, the thought was that permissions would be conveyed as a tuple of model(s) and action(s), however that is unreliable and inefficient in practice. Requiring a static name results in object permissions being much easier to manage and more efficient to display. This also allows us to specify a native ordering for ObjectPermissions.

The 0009_replicate_permissions schema migration should be updated to copy over the <app>.<action>_<model> form of legacy permission names to their corresponding new ObjectPermission instances.

Originally created by @jeremystretch on GitHub (Aug 3, 2020). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Make the `name` field on the ObjectPermission field mandatory. (Currently, it is optional.) ### Justification Experimentation with v2.9-beta1 has shown that a hard-coded name is necessary to effectively manage object-based permissions. Initially, the thought was that permissions would be conveyed as a tuple of model(s) and action(s), however that is unreliable and inefficient in practice. Requiring a static name results in object permissions being much easier to manage and more efficient to display. This also allows us to specify a native ordering for ObjectPermissions. The `0009_replicate_permissions` schema migration should be updated to copy over the `<app>.<action>_<model>` form of legacy permission names to their corresponding new ObjectPermission instances.
adam added the status: acceptedtype: housekeepingbeta labels 2025-12-29 18:32:09 +01:00
adam closed this issue 2025-12-29 18:32:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3935