# `MishkaCmsCore.Accounts.Notifiers.DisconnectLiveSockets`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/accounts/__notifiers/disconnect_live_sockets.ex#L5)

Cuts a user's live sockets after any write that can shrink what they may reach or end their being
signed in at all — see `MishkaCmsCore.Accounts.LiveSockets` for what "cut" means here.

In the notifier rather than in the actions, because a permission is taken away from the admin
form, from a JSON:API request and from in-app code, and all three arrive here. Notifiers run after
the transaction commits, so a socket is only cut once the change it is being cut for is real.

## What it watches

* `MishkaCmsCore.Accounts.UserPermission` — the grant itself. Every add and every removal writes a
  row of this join, whichever action on `User` asked for it, so watching the join catches the
  whole class instead of a list of action names that the next action would not be on.
* `MishkaCmsCore.Accounts.User` — a destroy, because the account is gone, and an update that
  writes anything but the address the account signs in with.
* `MishkaCmsCore.Accounts.Permission` — renaming one changes what
  `MishkaCmsCore.Accounts.Checks.AccessPermissions` answers for everyone holding it, and deleting
  one takes their grants with it. Who held it is read before the write by
  `MishkaCmsCore.Accounts.Changes.RememberPermissionHolders`, because by the time this runs the
  grant rows of a deleted permission are gone.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
