We store groups/ roles in another table due to legacy reasons.

I need to override following method in auth backend, by my own method
to get permissions from a custom role permission table. How can I do
it?


>>> override following method to get permissions from legacy table 
>>> role_permissions  <<<<

def get_group_permissions(self, user_obj) in
http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/backends.py

def get_group_permissions(self, user_obj):
23              """
24              Returns a set of permission strings that this user has
through his/her
25              groups.
26              """
27              if not hasattr(user_obj, '_group_perm_cache'):
28                  perms = Permission.objects.filter(group__user=user_obj
29                      ).values_list('content_type__app_label',
'codename'
30                      ).order_by()
31                  user_obj._group_perm_cache = set(["%s.%s" % (ct, name)
for ct, name in perms])
32              return user_obj._group_perm_cache
33

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to