Commits

Peter Sagerson  committed 7c26fb8

Django 1.4 compatibility.

Update auth APIs for object permissions.

  • Participants
  • Parent commits 3045fb3
  • Tags 1.0.18

Comments (0)

Files changed (4)

File django_auth_ldap/__init__.py

-version = (1, 0, 17)
-version_string = "1.0.17"
+version = (1, 0, 18)
+version_string = "1.0.18"

File django_auth_ldap/backend.py

     actually delegates most of its work to _LDAPUser, which is defined next.
     """
     supports_anonymous_user = False
-    supports_object_permissions = False
+    supports_object_permissions = True
 
     ldap = None # The cached ldap module (or mock object)
 
 
         return user
 
-    def has_perm(self, user, perm):
-        return perm in self.get_all_permissions(user)
+    def has_perm(self, user, perm, obj=None):
+        return perm in self.get_all_permissions(user, obj)
 
     def has_module_perms(self, user, app_label):
         for perm in self.get_all_permissions(user):
 
         return False
 
-    def get_all_permissions(self, user):
-        return self.get_group_permissions(user)
+    def get_all_permissions(self, user, obj=None):
+        return self.get_group_permissions(user, obj)
 
-    def get_group_permissions(self, user):
+    def get_group_permissions(self, user, obj=None):
         if not hasattr(user, 'ldap_user') and ldap_settings.AUTH_LDAP_AUTHORIZE_ALL_USERS:
             _LDAPUser(self, user=user) # This sets user.ldap_user
 

File docs/conf.py

 # The short X.Y version.
 version = '1.0'
 # The full version, including alpha/beta/rc tags.
-release = '1.0.17'
+release = '1.0.18'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 
 setup(
     name="django-auth-ldap",
-    version="1.0.17",
+    version="1.0.18",
     description="Django LDAP authentication backend",
     long_description=open('README.rst').read(),
     url="http://bitbucket.org/psagers/django-auth-ldap/",