You are here

public function RoleExpireApiService::deleteRecord in Role Expire 2.x

Same name and namespace in other branches
  1. 8 src/RoleExpireApiService.php \Drupal\role_expire\RoleExpireApiService::deleteRecord()

Delete a record from the database.

Parameters

int $uid: User ID.

string $rid: Role ID.

bool $delete_session: Whether to terminate user session or not.

1 call to RoleExpireApiService::deleteRecord()
RoleExpireApiService::writeRecord in src/RoleExpireApiService.php
Insert or update a record in the database.

File

src/RoleExpireApiService.php, line 114

Class

RoleExpireApiService
Class RoleExpireApiService.

Namespace

Drupal\role_expire

Code

public function deleteRecord($uid, $rid, $delete_session = TRUE) {
  $query = $this->database
    ->delete('role_expire');
  $query
    ->condition('uid', $uid)
    ->condition('rid', $rid);
  $query
    ->execute();
  if ($delete_session) {

    // Delete the user's sessions so they have login again with their new access.
    $this->sessionManager
      ->delete($uid);
  }
}