resolved by adding has_perm and get_all_permisions methods to my backend class.
Looks all methods should defined in backend, not just the one I want to change. On May 6, 1:53 pm, lray <lisara...@gmail.com> wrote: > I am writing an authorization backend to get some permissions from > custom tables. I added it to settings.py, > > It does not appear Django is calling get_group_permissions(self) from > this backend. I had print statements and nothing got printed in > Please help. > > class MyBackend(object): > supports_object_permissions = False > supports_anonymous_user = True > > def authenticate(self, username, password): > return None > > def get_group_permissions(self): > """ > Returns a set of permission strings that this user has through > his/her > groups self. > """ > print " in my backend group perm" > role = Role.objects.filter(user__exact = self.id) > if role is not None: > perms = > role.permissions.values_list('content_type__app_label', 'codename') > return set(["%s.%s" % (ct, name) for ct, name in perms]) > > Models.py > > class Role(models.Model): > group= models.ForeignKey(Group) > name = models.CharField(max_length=80, unique=True) > permissions = models.ManyToManyField(Permission, > verbose_name='permissions', blank=True > > def __unicode__(self): > return self.name > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.