Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor permissions #75

Open
nathan-osman opened this issue Aug 9, 2014 · 0 comments
Open

Refactor permissions #75

nathan-osman opened this issue Aug 9, 2014 · 0 comments

Comments

@nathan-osman
Copy link
Member

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:

  • can_view() - determine whether the provided user can view the article
  • can_edit() - determine whether the provided user can edit the article

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant