diff gpp/forums/models.py @ 459:9d3bd7304050

Fixing #221. Also combined all permissions checks into a new module, permissions.py. This allows us to cache user, category, and forum groups information since it rarely changes.
author Brian Neal <bgneal@gmail.com>
date Sat, 02 Jul 2011 23:35:45 +0000
parents e9f203c5f5bb
children 7388cdf61b25
line wrap: on
line diff
--- a/gpp/forums/models.py	Sat Jul 02 03:52:43 2011 +0000
+++ b/gpp/forums/models.py	Sat Jul 02 23:35:45 2011 +0000
@@ -30,24 +30,6 @@
     def __unicode__(self):
         return self.name
 
-    def can_access(self, user):
-        """
-        Checks to see if the given user has permission to access
-        this category.
-        If this category has no groups assigned to it, return true.
-        Else, return true if the user belongs to a group that has been
-        assigned to this category, and false otherwise.
-        """
-        if self.groups.count() == 0:
-            return True
-        if user.is_authenticated():
-            return self.groups.filter(user__pk=user.id).count() > 0
-        return False
-
-    def is_public(self):
-        """Returns true if this is a public category, viewable by all."""
-        return self.groups.count() == 0
-
 
 class ForumManager(models.Manager):
     """