diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index a0ed4f366f..3ea184a7f8 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -358,6 +358,9 @@ class AnonymousUser(object): def has_perm(self, perm): return False + def has_perms(self, perm_list): + return False + def has_module_perms(self, module): return False diff --git a/tests/regressiontests/auth_backends/tests.py b/tests/regressiontests/auth_backends/tests.py index 3ec2a059ad..d22f0bf939 100644 --- a/tests/regressiontests/auth_backends/tests.py +++ b/tests/regressiontests/auth_backends/tests.py @@ -4,7 +4,7 @@ except NameError: 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 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 """}