permission.granted_to now handle anonymous user

This commit is contained in:
Élie Bouttier 2014-08-11 23:53:32 -07:00
parent d9c3e214e0
commit 95893c04d9

View file

@ -392,6 +392,8 @@ class PermissionModel(models.Model):
abstract = True
def granted_to(self, user):
if not user.is_authenticated():
return False
if self.grantee_type == self.GRANTEE_USER:
return user.username == self.grantee_name
elif self.grantee_type == self.GRANTEE_GROUP: