Skip to content

Commit

Permalink
CERT: Add function to delete certificates for user and specific object.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastocker committed Oct 27, 2023
1 parent ae79995 commit 32e6eb7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,4 +586,17 @@ private function createUserCertificate(array $row): ilUserCertificate
isset($row['id']) ? (int) $row['id'] : null
);
}

public function deleteUserCertificatesForObject(int $userId, int $obj_id): void
{
$this->logger->debug(sprintf('START - Delete certificate for user("%s") in object (obj_id: %s)"', $userId, $obj_id));

$sql = 'DELETE FROM il_cert_user_cert ' . PHP_EOL
. ' WHERE usr_id = ' . $this->database->quote($userId, 'integer') . PHP_EOL
. ' AND obj_id = ' . $this->database->quote($obj_id, 'integer');

$this->database->manipulate($sql);

$this->logger->debug(sprintf('END - Successfully deleted certificate for user("%s") in object (obj_id: %s)"', $userId, $obj_id));
}
}

0 comments on commit 32e6eb7

Please sign in to comment.