Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7304 -- Gave AnonymousUser a has_perms() method, which it was …

…lacking

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 8bc442e7715f56cf108a35025493af90687e33ee 1 parent bfcecfe
@adrianholovaty adrianholovaty authored
View
3  django/contrib/auth/models.py
@@ -358,6 +358,9 @@ def _get_user_permissions(self):
def has_perm(self, perm):
return False
+ def has_perms(self, perm_list):
+ return False
+
def has_module_perms(self, module):
return False
View
8 tests/regressiontests/auth_backends/tests.py
@@ -4,7 +4,7 @@
from sets import Set as set # Python 2.3 fallback
__test__ = {'API_TESTS': """
->>> from django.contrib.auth.models import User, Group, Permission
+>>> from django.contrib.auth.models import User, Group, Permission, AnonymousUser
>>> from django.contrib.contenttypes.models import ContentType
# No Permissions assigned yet, should return False except for superuser
@@ -69,4 +69,10 @@
True
>>> user.has_perms(['auth.test3', 'auth.test_group'])
True
+
+>>> user = AnonymousUser()
+>>> user.has_perm('test')
+False
+>>> user.has_perms(['auth.test2', 'auth.test3'])
+False
"""}
Please sign in to comment.
Something went wrong with that request. Please try again.