Settings → Single sign-on → Group → role map. One line per group: group = viewer | operator | admin | custom:<role id>. At every sign-in a person gets the most privileged role among their groups (a custom role ranks just under its base); no match means the default role. The identity provider decides each time, so removing someone from a group removes the role at their next sign-in.
Settings → Provisioning (SCIM). SCIM 2.0 at https://<netlens>/scim/v2 lets Entra ID, Okta, Keycloak or Authentik make an account when somebody joins and deactivate it, with their sessions ended, when they leave. It has its own bearer token (shown once, stored as a hash, optionally limited to the provider’s networks). The provider can only see and change accounts it made itself: a local administrator can never be touched. It can never make an administrator (new accounts get the viewer or operator role you choose; the group map can give more at sign-in) and can never remove the last administrator. At the first single sign-on the person is matched to the account the provider made (by the externalId, equal to the sub claim, or by an e-mail address the provider vouches for). Without the Enterprise edition the provider can still deactivate and remove accounts, but not make new ones. SAML is not built: every provider above also speaks OpenID Connect.