Yes, I have to agree entirely..
I bungled the OP. Here is what the code snippet should have been:
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(username='clint')
>>> u.get_all_permissions()
set([u'wb.delete_libraryitem', u'wb.change_libraryitem'])
>>> u.has_perm("wb.add_libraryitem")
True
How can that be?
Your reply did prod me into realizing that I had made a similar typo
while trying to resolve this question last night. Anyway, here is the
answer:
>>> u.is_superuser
True
If the user is not superuser, it returns False. u.has_perm() returns
true for ANY permission if u is superuser.
>>> u.has_perm("wb.anything")
True
This solves the problem. Thanks for the help Andy. :)
Don Slowik
On Feb 10, 10:49 pm, Andy McKay <a...@clearwind.ca> wrote:
> On Fri, Feb 10, 2012 at 4:01 PM, dslowik <dslo
...@tellink.net> wrote:
> >>>> u.get_all_permissions()
> > set([u'wb.delete_libraryitem', u'wb.change_libraryitem'])
> >>>> u.has_perm("wb.change_libraryitem")
> > True
> > ...Shouldn't that be False?
> Why would it be False? get_all_permissions: Returns a set of
> permission strings that the user has.... has_perm: Returns True if the
> user has the specified permission.
> https://docs.djangoproject.com/en/1.2/topics/auth/#django.contrib.aut...