docs: def _populate_permissions(resources, content_type_id):
      """ Add all missing permissions to the database. """
      from django.contrib.auth.models import Permission
      # read the whole auth_permission table into memory
      db_perms = [perm.codename for perm in Permission.objects.all()]
  
      for resource in resources:
          # get all resource's permissions that are not already in db
          perms = [perm for perm in resource.access_controller.get_perm_names(resource) if perm not in db_perms]
          for perm in perms:
              _save_new_permission(perm, content_type_id)