| @ -21,7 +21,9 @@ def set_oobe_flow_authentication(apps: Apps, schema_editor: BaseDatabaseSchemaEd | ||||
|         pass | ||||
|  | ||||
|     if users.exists(): | ||||
|         Flow.objects.using(db_alias).filter(slug="initial-setup").update(authentication="require_superuser") | ||||
|         Flow.objects.using(db_alias).filter(slug="initial-setup").update( | ||||
|             authentication="require_superuser" | ||||
|         ) | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
| @ -31,9 +31,9 @@ def set_default_group_mappings(apps: Apps, schema_editor): | ||||
|     db_alias = schema_editor.connection.alias | ||||
|  | ||||
|     for source in LDAPSource.objects.using(db_alias).all(): | ||||
|         if source.property_mappings_group.exists(): | ||||
|         if source.property_mappings_group.using(db_alias).exists(): | ||||
|             continue | ||||
|         source.property_mappings_group.set( | ||||
|         source.property_mappings_group.using(db_alias).set( | ||||
|             LDAPPropertyMapping.objects.using(db_alias).filter( | ||||
|                 managed="goauthentik.io/sources/ldap/default-name" | ||||
|             ) | ||||
|  | ||||
| @ -13,7 +13,7 @@ def migrate_configuration_stage(apps: Apps, schema_editor: BaseDatabaseSchemaEdi | ||||
|  | ||||
|     for stage in AuthenticatorValidateStage.objects.using(db_alias).all(): | ||||
|         if stage.configuration_stage: | ||||
|             stage.configuration_stages.set([stage.configuration_stage]) | ||||
|             stage.configuration_stages.using(db_alias).set([stage.configuration_stage]) | ||||
|             stage.save() | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -15,7 +15,7 @@ def assign_sources(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): | ||||
|  | ||||
|     sources = Source.objects.using(db_alias).all() | ||||
|     for stage in IdentificationStage.objects.using(db_alias).all(): | ||||
|         stage.sources.set(sources) | ||||
|         stage.sources.using(db_alias).set(sources) | ||||
|         stage.save() | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -12,7 +12,7 @@ def set_generated_name(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): | ||||
|  | ||||
|     for prompt in Prompt.objects.using(db_alias).all(): | ||||
|         name = prompt.field_key | ||||
|         stage = prompt.promptstage_set.order_by("name").first() | ||||
|         stage = prompt.promptstage_set.using(db_alias).order_by("name").first() | ||||
|         if stage: | ||||
|             name += "_" + stage.name | ||||
|         else: | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Marc 'risson' Schmitt
					Marc 'risson' Schmitt