2buntu / 2buntu-blog

Source code for the 2buntu blog.
http://2buntu.com
Apache License 2.0
15 stars 11 forks source link

Refactor permissions #75

Open nathan-osman opened 10 years ago

nathan-osman commented 10 years ago

The permission system currently works, but it is overly complex and consequently there is a lot of code repeated, violating the DRY principle. It would be nice to consolidate the permissions into a small group of methods on the Article model. For example:

These are boolean methods. However, we also need a @classmethod that returns a modified queryset that filters articles that the user cannot view. This is used basically anywhere a list of articles is needed/displayed.

This needs to be carefully planned and thought out to avoid the organizational problem that currently exists.