Re: Django Custom User Admin Login
Also, from initial tests it appears that django-guardian is not setting permissions with custom user. I wrote a small manage.py script to test that:
from django.core.management.base import BaseCommand, CommandError
from iiitd.models import *
from guardian.shortcuts import assign_perm, remove_perm
class Command(BaseCommand):
def handle(self, *args, **options):
user = MyUser.objects.filter(username='abc')[0]
stream = Stream.objects.filter(uuid='001')[0]
assign_perm('read_stream', user, stream)
print user.has_perm('read_stream', stream)
remove_perm('read_stream', user, stream)
print user.has_perm('read_stream', stream)
It prints True in both cases.
However, the guardian_userobjectpermission table is updating correctly when I add or delete permissions. Confused. o.O
-- from django.core.management.base import BaseCommand, CommandError
from iiitd.models import *
from guardian.shortcuts import assign_perm, remove_perm
class Command(BaseCommand):
def handle(self, *args, **options):
user = MyUser.objects.filter(username='abc')[0]
stream = Stream.objects.filter(uuid='001')[0]
assign_perm('read_stream', user, stream)
print user.has_perm('read_stream', stream)
remove_perm('read_stream', user, stream)
print user.has_perm('read_stream', stream)
It prints True in both cases.
However, the guardian_userobjectpermission table is updating correctly when I add or delete permissions. Confused. o.O
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dc7c1d92-5a1c-4eb7-812f-6a1bcd09ccdf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home