permission.backends.authenticate_backend: 22 total statements, 57.9% covered

Generated: Thu 2012-03-01 14:22 CST

Source file: /home/alisue/Dropbox/Codes/django-permission/permission/backends/authenticate_backend.py

Stats: 11 executed, 8 missed, 3 excluded, 42 ignored

  1. # vim: set fileencoding=utf-8 :
  2. """
  3. short module explanation
  4. AUTHOR:
  5. lambdalisue[Ali su ae] (lambdalisue@hashnote.net)
  6. License:
  7. The MIT License (MIT)
  8. Copyright (c) 2012 Alisue allright reserved.
  9. Permission is hereby granted, free of charge, to any person obtaining a copy
  10. of this software and associated documentation files (the "Software"), to
  11. deal in the Software without restriction, including without limitation the
  12. rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  13. sell copies of the Software, and to permit persons to whom the Software is
  14. furnished to do so, subject to the following conditions:
  15. The above copyright notice and this permission notice shall be included in
  16. all copies or substantial portions of the Software.
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  23. IN THE SOFTWARE.
  24. """
  25. from __future__ import with_statement
  26. from django.contrib.auth.backends import ModelBackend as AuthModelBackend
  27. from django.contrib.auth.backends import RemoteUserBackend as AuthRemoteUserBackend
  28. class ModelBackend(AuthModelBackend):
  29. def get_group_permissions(self, user_obj, obj=None):
  30. """With django-permission, group permission is not available."""
  31. return set()
  32. def get_all_permissions(self, user_obj, obj=None):
  33. """with django-permission, user permission is not available."""
  34. return set()
  35. def has_perm(self, user_obj, perm, obj=None):
  36. """with django-permission, permission check is handled by PermissionBackend"""
  37. return False
  38. def has_module_perms(self, user_obj, app_label):
  39. """with django-permission, permission check is handled by PermissionBackend"""
  40. return False
  41. class RemoteUserBackend(AuthRemoteUserBackend):
  42. def get_group_permissions(self, user_obj, obj=None):
  43. """With django-permission, group permission is not available."""
  44. return set()
  45. def get_all_permissions(self, user_obj, obj=None):
  46. """with django-permission, user permission is not available."""
  47. return set()
  48. def has_perm(self, user_obj, perm, obj=None):
  49. """with django-permission, permission check is handled by PermissionBackend"""
  50. return False
  51. def has_module_perms(self, user_obj, app_label):
  52. """with django-permission, permission check is handled by PermissionBackend"""
  53. return False