mirror of https://github.com/zulip/zulip.git
Add a script to reactivated deactivated realms.
This commit is contained in:
parent
79297898f1
commit
d890011442
|
@ -376,6 +376,10 @@ def do_deactivate_realm(realm):
|
|||
# notice when they try to log in.
|
||||
delete_user_sessions(user)
|
||||
|
||||
def do_reactivate_realm(realm):
|
||||
realm.deactivated = False
|
||||
realm.save(update_fields=["deactivated"])
|
||||
|
||||
def do_deactivate_user(user_profile, log=True, _cascade=True):
|
||||
if not user_profile.is_active:
|
||||
return
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
import sys
|
||||
|
||||
from zerver.lib.actions import do_reactivate_realm
|
||||
from zerver.models import get_realm
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = """Script to reactivate a deactivated realm."""
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('domain', metavar='<domain>', type=str,
|
||||
help='domain of realm to reactivate')
|
||||
|
||||
def handle(self, *args, **options):
|
||||
realm = get_realm(options["domain"])
|
||||
if realm is None:
|
||||
print("Could not find realm %s" % (options["domain"],))
|
||||
sys.exit(1)
|
||||
print("Reactivating", options["domain"])
|
||||
do_reactivate_realm(realm)
|
||||
print("Done!")
|
Loading…
Reference in New Issue