Opened 17 years ago
Closed 16 years ago
#6121 closed (duplicate)
Need ability to identify permissions and group by name
Reported by: | jdetaeye | Owned by: | nobody |
---|---|---|---|
Component: | Core (Serialization) | Version: | dev |
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: | no | UI/UX: | no |
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 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → 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.