2013-04-23 18:51:17 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2013-04-02 18:00:12 +02:00
|
|
|
from optparse import make_option
|
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
|
2013-07-29 23:03:31 +02:00
|
|
|
from zerver.lib.actions import delete_all_user_sessions, \
|
2013-04-02 18:00:12 +02:00
|
|
|
delete_realm_user_sessions
|
2015-10-13 22:54:35 +02:00
|
|
|
from zerver.models import get_realm
|
2013-04-02 18:00:12 +02:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
help = "Log out all users."
|
|
|
|
|
|
|
|
option_list = BaseCommand.option_list + (
|
|
|
|
make_option('--realm',
|
|
|
|
dest='realm',
|
|
|
|
action='store',
|
|
|
|
default=None,
|
|
|
|
help="Only logout all users in a particular realm"),
|
|
|
|
)
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
if options["realm"]:
|
2015-10-13 22:54:35 +02:00
|
|
|
realm = get_realm(options["realm"])
|
2013-04-02 18:00:12 +02:00
|
|
|
delete_realm_user_sessions(realm)
|
|
|
|
else:
|
|
|
|
delete_all_user_sessions()
|