Opened 8 years ago

Closed 7 years ago

#6121 closed (duplicate)

Need ability to identify permissions and group by name

Reported by: jdetaeye Owned by: nobody
Component: Core (Serialization) Version: master
Severity: Keywords: permissions fixtures
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

User permissions are stored as integer numbers in the database and in fixtures files. The integers are auto-generated based on the defined models and user-defined permissions.

For instance, a json fixture to define a group looks like this:

[
[{"pk": 1, "model": "auth.group", "fields": {"name": "mygroup", "permissions": [22, 23, 24, 25, 26, 27, 28, 29, 30, 31]}}
]

The problem with this setup is that the numbers change with any model change in the applications, and therefore invalidate all existing group fixtures.
This makes it inpractical to define or maintain predefined group definitions, and also makes it harder to re-use django applications across projects.

Ideally, the fixtures store the permissions as a string, which is translated into the internal numbering used by django during the load.
Having the ability to define groups in the models.py or admin.py would also be helpful.

(Ticket #6020 describes another situation where identifying a group by a string comes in handy)

Change History (2)

comment:1 Changed 8 years ago by Simon G <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by russellm

  • Resolution set to duplicate
  • Status changed from new to closed

Making a special case of groups and permissions is not really a good idea. However, providing the ability to cross-reference entries in a fixture by name would be useful; in fact, it is required to work around some other issues in serialization. This idea has been proposed elsewhere; #7052 is the ticket tracking ideas and progress.

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