django-cas
django-cas copied to clipboard
Django 1.11 user.has_perm doesn't work with CAS.
Hello,
I have a problem using django-cas. when I try to use the Django has_perm method to authorize some access with user permissions in code. When I use the method has perm with Middleware and Auth Backend from CAS the method does not work as it should, it always returns False unless the user is superuser. could you please help me with this? . I try the same action deactivating CAS auth and using local Auth and the method work propertly. Thanks in advance.
Django Version 1.11.4 and 1.11.5
Pdb without CAS client active (Local Auth).
(Pdb) user <User: baseproject> (Pdb) perm 'auth.pruebaapi' (Pdb) user.user_permissions.all()[0] <Permission: auth | permiso | pruebaapi> (Pdb) user.user_permissions.all()[0].codename 'pruebaapi' (Pdb) user.has_perm(perm) True (Pdb)
Pdb with Cas client active
(Pdb) user <User: baseproject> (Pdb) perm 'auth.pruebaapi' (Pdb) user.user_permissions.all()[0] <Permission: auth | permiso | pruebaapi> (Pdb) user.user_permissions.all()[0].codename 'pruebaapi' (Pdb) user.has_perm(perm) False (Pdb) Why ?