We use the style of "app_label.permission_name" in multiple places of
our code to refer to given auth.models.Permission. However, there is
no unique key for that combination, the key is content_type,
permission_name. I verified that it is actually possible to hit this
problem by using the Meta.permissions.
I am not sure what we can do about this... Or if we even need to do
anything about this.
Without schema changes we can't have a DB constraint for the key. But,
maybe we could validate (as part of model validation) that there are
no overlapping permissions? If the user goes and creates overlapping
permissions despite of this, we can't do anything about that.
The reason why I am wondering about this is that I'd like to add
Permissions.objects.get_permission('app_label.permission_name')
convenience method. And, while investigating that I realized that the
app_label, permission name isn't a key...
I am likely going to add the get_permission() anyways, it will just
throw "returned more than 1" if the above problem is hit.
Thoughts?
- Anssi
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.