Is there a way to retrieve all users with a specific permission (eg "Post comments"). I only found the possibility to get them by their role:
Drupal::entityQuery('user')
->condition('status', 1)
->condition('roles', 'administrator')
->execute();
or
Drupal::service('entity_type.manager')
->getStorage('user')
->loadByProperties(['roles' => 'administrator']);