Ticket #12557: supports_anonymous_users.diff
File supports_anonymous_users.diff, 1.8 KB (added by , 15 years ago) |
---|
-
django/contrib/auth/backends.py
12 12 Authenticates against django.contrib.auth.models.User. 13 13 """ 14 14 supports_object_permissions = False 15 supports_anonymous_users = False 15 16 16 17 # TODO: Model, login attribute name and password attribute name should be 17 18 # configurable. -
django/contrib/auth/models.py
397 397 user_permissions = property(_get_user_permissions) 398 398 399 399 def has_perm(self, perm, obj=None): 400 for backend in auth.get_backends(): 401 if backend.supports_anonymous_users: 402 if hasattr(backend, "has_perm"): 403 if obj is not None: 404 if (backend.supports_object_permissions and 405 backend.has_perm(self, perm, obj)): 406 return True 407 else: 408 if backend.has_perm(self, perm): 409 return True 400 410 return False 401 411 402 412 def has_perms(self, perm_list, obj=None): 413 for perm in perm_list: 414 if not self.has_perm(perm, obj): 415 return False 403 416 return False 404 417 405 418 def has_module_perms(self, module): 419 for backend in auth.get_backends(): 420 if (backend.supports_anonymous_users and 421 hasattr(backend, "has_module_perms") and 422 backend.has_module_perms(self, app_label)): 423 return True 406 424 return False 407 425 408 426 def get_and_delete_messages(self):