Unfortunately, you can't look up sessions by user, so you've have to
load every active session and see if its for the user you wish to
logout. Alternatively, you could create your own mapping of users to
sessions, or add some middleware that verifies the user is active on
every request, and signs them out if not (so the logout wouldn't happen
during the cron job, but rather the first time they try to access the
site after being marked inactive).

_Nik

On 8/12/2014 11:44 AM, François Schiettecatte wrote:
> You should take a look at sessions:
>
>       https://docs.djangoproject.com/en/1.7/topics/http/sessions/
>
> You can arbitrarily remove sessions regardless of expiration which will log 
> out the user.
>
> François
>
> On Aug 12, 2014, at 2:32 PM, Torsten Bronger <[email protected]> 
> wrote:
>
>> Hallöchen!
>>
>> I know that there is a logout(request) routine, but how to program a
>> logout(user) routine?
>>
>> Background:  Every night, a cronjob iterates over all active users
>> in our Django deployment and checks whether they can still be found
>> in our LDAP directory.  Every user that is not found anymore is set
>> to inactive.  Unfortunately, this is not enough, he or she must be
>> logged out.  But how to do that?
>>
>> Tschö,
>> Torsten.
>>
>> -- 
>> Torsten Bronger    Jabber ID: [email protected]
>>                                  or http://bronger-jmp.appspot.com
>>
>> -- 
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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/87egwlk18f.fsf%40physik.rwth-aachen.de.
>> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/53EA6573.9080303%40consbio.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to