org settings: Add button to deactivate organization.

This adds button under "Organization profile" settings, which
deactivates the organization and sends an "event" to all the
active user and log out them.

Fixes: #8212.
This commit is contained in:
Shubham Dhama
2018-01-30 19:28:50 +05:30
committed by Tim Abbott
parent 2733c0551e
commit 9feae472f8
9 changed files with 88 additions and 1 deletions

View File

@@ -607,6 +607,10 @@ def do_deactivate_realm(realm: Realm) -> None:
# notice when they try to log in.
delete_user_sessions(user)
event = dict(type="realm", op="deactivated",
realm_id=realm.id)
send_event(event, active_user_ids(realm.id))
def do_reactivate_realm(realm: Realm) -> None:
realm.deactivated = False
realm.save(update_fields=["deactivated"])