mirror of https://github.com/zulip/zulip.git
26 lines
767 B
Python
26 lines
767 B
Python
|
from optparse import make_option
|
||
|
|
||
|
from django.core.management.base import BaseCommand
|
||
|
|
||
|
from zephyr.lib.actions import delete_all_user_sessions, \
|
||
|
delete_realm_user_sessions
|
||
|
from zephyr.models import Realm
|
||
|
|
||
|
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"]:
|
||
|
realm = Realm.objects.get(domain=options["realm"])
|
||
|
delete_realm_user_sessions(realm)
|
||
|
else:
|
||
|
delete_all_user_sessions()
|