public function deleteRole(APIRole $role)
{
if ($this->repository->hasAccess('role', 'delete') !== true) {
throw new UnauthorizedException('role', 'delete');
}
$loadedRole = $this->loadRole($role->id);
$this->repository->beginTransaction();
try {
$this->userHandler->deleteRole($loadedRole->id);
$this->repository->commit();
} catch (Exception $e) {
$this->repository->rollback();
throw $e;
}
}