torchbox/wagtail — pull request #438 by nimasmi (2014-07-08 13:49:09+00:00)
Title: Integrate django admin groups

This adds a 'Groups' menu item below 'Users', and introduces a hook for Wagtail modules to register permissions which you want to expose in the interface.

The groups template shows:
- django object permissions in the 'Object permissions' html table, sorted as 'add', 'change' and 'delete' columns—these are identified internally by the beginning of the `codename` string of each permission, e.g. `add_document`
- other django permissions in the 'Other permissions' html table (those which don't start with 'add_', 'change_' or 'delete_') with each permission's `name` shown
- wagtail field panels for assigning `GroupPagePermission` objects to the group

I have speculatively registered object permissions for:
- `django.contrib.auth.models.Group`
- `django.contrib.auth.models.User`
- `wagtail.wagtailusers.models.UserProfile`
- `wagtail.wagtaildocs.models.Document`
- `wagtail.wagtailimages.models.Image`
- all snippets defined in the Wagtail-using CMS project

At present there's a single 'other permission' for 'Can access Wagtail admin'.

Those Django internal permissions in `django.contrib.auth.models.Permission` but not registered with the hooks will not be shown, but tests are written to ensured their assignment is unaltered by these views.