mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
| """} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user