def remove_sshkey_view_permission(apps, schema_editor):
    SSHKey = apps.get_model('jobs', 'SSHKey')
    PermissionMigrator(apps, SSHKey, 'view', user_field='created_by').remove()
    PermissionMigrator(apps, SSHKey, 'change',
                       user_field='created_by').remove()
    PermissionMigrator(apps, SSHKey, 'delete',
                       user_field='created_by').remove()
예제 #2
0
def migrate_public_keys(apps, schema_editor):
    SSHKey = apps.get_model("keys", "SSHKey")

    # create a mapping of key fingerprint -> list of clusters
    ssh_keys = ssh_key_mapping(apps)

    # go through the mapping and create a title for the key
    for fingerprint, clusters in list(ssh_keys.items()):
        # cut off after 100 characters in case of lots of clusters
        title = "key used on: " + ",".join([cluster.identifier for cluster in clusters])
        ssh_key = SSHKey(
            title=title[:100],
            key=clusters[0].public_key.strip(),
            created_by=cluster.created_by,
            fingerprint=fingerprint,
        )
        ssh_key.save()

    PermissionMigrator(apps, SSHKey, "view", user_field="created_by").assign()
    PermissionMigrator(apps, SSHKey, "change", user_field="created_by").assign()
    PermissionMigrator(apps, SSHKey, "delete", user_field="created_by").assign()
예제 #3
0
def assign_spark_job_view_permission(apps, schema_editor):
    SparkJob = apps.get_model('jobs', 'SparkJob')
    PermissionMigrator(apps, SparkJob, 'created_by').assign()
예제 #4
0
def assign_cluster_view_permission(apps, schema_editor):
    Cluster = apps.get_model('clusters', 'Cluster')
    PermissionMigrator(apps, Cluster, 'view', user_field='created_by').assign()
def assign_spark_job_view_permission_to_group(apps, schema_editor):
    SparkJob = apps.get_model('jobs', 'SparkJob')
    Group = apps.get_model('auth', 'Group')

    group, created = Group.objects.get_or_create(name='Spark job maintainers')
    PermissionMigrator(apps, SparkJob, 'view', group=group).assign()
def remove_spark_job_view_permission_to_group(apps, schema_editor):
    SparkJob = apps.get_model('jobs', 'SparkJob')
    Group = apps.get_model('auth', 'Group')

    group = Group.objects.get(name='Spark job maintainers')
    PermissionMigrator(apps, SparkJob, 'view', group=group).remove()
def assign_cluster_more_permission(apps, schema_editor):
    Cluster = apps.get_model("clusters", "Cluster")
    PermissionMigrator(apps, Cluster, "change",
                       user_field="created_by").assign()
    PermissionMigrator(apps, Cluster, "delete",
                       user_field="created_by").assign()
def assign_cluster_more_permission(apps, schema_editor):
    Cluster = apps.get_model('clusters', 'Cluster')
    PermissionMigrator(apps, Cluster, 'change',
                       user_field='created_by').assign()
    PermissionMigrator(apps, Cluster, 'delete',
                       user_field='created_by').assign()
def assign_spark_job_view_permission_to_group(apps, schema_editor):
    SparkJob = apps.get_model("jobs", "SparkJob")
    Group = apps.get_model("auth", "Group")

    group, created = Group.objects.get_or_create(name="Spark job maintainers")
    PermissionMigrator(apps, SparkJob, "view", group=group).assign()
def remove_spark_job_view_permission_to_group(apps, schema_editor):
    SparkJob = apps.get_model("jobs", "SparkJob")
    Group = apps.get_model("auth", "Group")

    group = Group.objects.get(name="Spark job maintainers")
    PermissionMigrator(apps, SparkJob, "view", group=group).remove()
예제 #11
0
def assign_spark_job_more_permission(apps, schema_editor):
    SparkJob = apps.get_model('jobs', 'SparkJob')
    PermissionMigrator(apps, SparkJob, 'change',
                       user_field='created_by').assign()
    PermissionMigrator(apps, SparkJob, 'delete',
                       user_field='created_by').assign()
def assign_spark_job_more_permission(apps, schema_editor):
    SparkJob = apps.get_model("jobs", "SparkJob")
    PermissionMigrator(apps, SparkJob, "change",
                       user_field="created_by").assign()
    PermissionMigrator(apps, SparkJob, "delete",
                       user_field="created_by").assign()
def assign_cluster_view_permission(apps, schema_editor):
    Cluster = apps.get_model("clusters", "Cluster")
    PermissionMigrator(apps, Cluster, "view", user_field="created_by").assign()
예제 #14
0
def remove_spark_job_view_permission(apps, schema_editor):
    SparkJob = apps.get_model('jobs', 'SparkJob')
    PermissionMigrator(apps, SparkJob, 'view',
                       user_field='created_by').remove()
def remove_sshkey_view_permission(apps, schema_editor):
    SSHKey = apps.get_model("jobs", "SSHKey")
    PermissionMigrator(apps, SSHKey, "view", user_field="created_by").remove()
    PermissionMigrator(apps, SSHKey, "change", user_field="created_by").remove()
    PermissionMigrator(apps, SSHKey, "delete", user_field="created_by").remove()
예제 #16
0
def remove_spark_job_view_permission(apps, schema_editor):
    SparkJob = apps.get_model("jobs", "SparkJob")
    PermissionMigrator(apps, SparkJob, "view",
                       user_field="created_by").remove()