You are here

function openid_connect_disconnect_account in OpenID Connect / OAuth client 7

Same name and namespace in other branches
  1. 8 openid_connect.module \openid_connect_disconnect_account()

Disconnect an external OpenID Connect account from a Drupal user account.

Parameters

object $account: The Drupal user object.

string $client_name: The client machine name.

string $sub: The 'sub' property identifying the external account (optional).

1 call to openid_connect_disconnect_account()
openid_connect_connect_form_submit in includes/openid_connect.forms.inc
Submit callback for the connect account form.

File

./openid_connect.module, line 738
A pluggable client implementation for the OpenID Connect protocol.

Code

function openid_connect_disconnect_account($account, $client_name, $sub = NULL) {
  $query = db_delete('authmap');
  $query
    ->condition('uid', $account->uid)
    ->condition('module', 'openid_connect_' . $client_name);
  if ($sub !== NULL) {
    $query
      ->condition('authname', $sub);
  }
  $query
    ->execute();
}