开发者

django auth - has_perm returns True while list of permissions is empty

开发者 https://www.devze.com 2022-12-24 16:54 出处:网络
I\'m wondering why this code section prints out the开发者_JAVA百科 following: print \"request.user.has_perm(\'bug_tracking.is_developer\'): \" + str(request.user.has_perm(\'bug_tracking.is_developer\

I'm wondering why this code section prints out the开发者_JAVA百科 following:

print "request.user.has_perm('bug_tracking.is_developer'): " + str(request.user.has_perm('bug_tracking.is_developer'))
                    print request.user.get_all_permissions()

request.user.has_perm('bug_tracking.is_developer'): True
set([])

I would expect that request.user.has_perm('bug_tracking.is_developer') returns false if the list of all permissions is empty!?


huups...was a super user ;-)

Superuser status Designates that this user has all permissions without explicitly assigning them.


Also note that if you have a method has_perm in you User model, the authentication backends' has_perm methods will not called ever.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号