def _populate_permissions(resources, content_type_id):
    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)
Refresh context with new declarations from known registries.
dataset/ETHPy150Open wuher/devil/devil/perm/management.py/_populate_permissions--crossover with--dataset/ETHPy150Open numba/numba/numba/typing/context.py/BaseContext.refresh