authentik.policies.event_matcher.migrations.0001_squashed_0018_alter_eventmatcherpolicy_action

  1# Generated by Django 3.2.8 on 2021-10-10 16:11
  2
  3import django.db.models.deletion
  4from django.db import migrations, models
  5
  6
  7class Migration(migrations.Migration):
  8    replaces = [
  9        ("authentik_policies_event_matcher", "0001_initial"),
 10        ("authentik_policies_event_matcher", "0002_auto_20201230_2046"),
 11        ("authentik_policies_event_matcher", "0003_auto_20210110_1907"),
 12        ("authentik_policies_event_matcher", "0004_auto_20210112_2158"),
 13        ("authentik_policies_event_matcher", "0005_auto_20210202_1821"),
 14        ("authentik_policies_event_matcher", "0006_auto_20210203_1134"),
 15        ("authentik_policies_event_matcher", "0007_auto_20210209_1657"),
 16        ("authentik_policies_event_matcher", "0008_auto_20210213_1640"),
 17        ("authentik_policies_event_matcher", "0009_auto_20210215_2159"),
 18        ("authentik_policies_event_matcher", "0010_auto_20210222_1821"),
 19        ("authentik_policies_event_matcher", "0011_auto_20210302_0856"),
 20        ("authentik_policies_event_matcher", "0012_auto_20210323_1339"),
 21        ("authentik_policies_event_matcher", "0013_alter_eventmatcherpolicy_app"),
 22        ("authentik_policies_event_matcher", "0014_alter_eventmatcherpolicy_app"),
 23        ("authentik_policies_event_matcher", "0015_alter_eventmatcherpolicy_app"),
 24        ("authentik_policies_event_matcher", "0016_alter_eventmatcherpolicy_action"),
 25        ("authentik_policies_event_matcher", "0017_alter_eventmatcherpolicy_action"),
 26        ("authentik_policies_event_matcher", "0018_alter_eventmatcherpolicy_action"),
 27    ]
 28
 29    initial = True
 30
 31    dependencies = [
 32        ("authentik_policies", "0004_policy_execution_logging"),
 33    ]
 34
 35    operations = [
 36        migrations.CreateModel(
 37            name="EventMatcherPolicy",
 38            fields=[
 39                (
 40                    "policy_ptr",
 41                    models.OneToOneField(
 42                        auto_created=True,
 43                        on_delete=django.db.models.deletion.CASCADE,
 44                        parent_link=True,
 45                        primary_key=True,
 46                        serialize=False,
 47                        to="authentik_policies.policy",
 48                    ),
 49                ),
 50                (
 51                    "action",
 52                    models.TextField(
 53                        blank=True,
 54                        choices=[
 55                            ("login", "Login"),
 56                            ("login_failed", "Login Failed"),
 57                            ("logout", "Logout"),
 58                            ("user_write", "User Write"),
 59                            ("suspicious_request", "Suspicious Request"),
 60                            ("password_set", "Password Set"),
 61                            ("secret_view", "Secret View"),
 62                            ("secret_rotate", "Secret Rotate"),
 63                            ("invitation_used", "Invite Used"),
 64                            ("authorize_application", "Authorize Application"),
 65                            ("source_linked", "Source Linked"),
 66                            ("impersonation_started", "Impersonation Started"),
 67                            ("impersonation_ended", "Impersonation Ended"),
 68                            ("flow_execution", "Flow Execution"),
 69                            ("policy_execution", "Policy Execution"),
 70                            ("policy_exception", "Policy Exception"),
 71                            ("property_mapping_exception", "Property Mapping Exception"),
 72                            ("system_task_execution", "System Task Execution"),
 73                            ("system_task_exception", "System Task Exception"),
 74                            ("system_exception", "System Exception"),
 75                            ("configuration_error", "Configuration Error"),
 76                            ("model_created", "Model Created"),
 77                            ("model_updated", "Model Updated"),
 78                            ("model_deleted", "Model Deleted"),
 79                            ("email_sent", "Email Sent"),
 80                            ("update_available", "Update Available"),
 81                            ("custom_", "Custom Prefix"),
 82                        ],
 83                        help_text=(
 84                            "Match created events with this action type. When left empty, all"
 85                            " action types will be matched."
 86                        ),
 87                    ),
 88                ),
 89                (
 90                    "client_ip",
 91                    models.TextField(
 92                        blank=True,
 93                        help_text=(
 94                            "Matches Event's Client IP (strict matching, for network matching use"
 95                            " an Expression Policy)"
 96                        ),
 97                    ),
 98                ),
 99                (
100                    "app",
101                    models.TextField(
102                        blank=True,
103                        choices=[
104                            ("authentik.admin", "authentik Admin"),
105                            ("authentik.api", "authentik API"),
106                            ("authentik.events", "authentik Events"),
107                            ("authentik.crypto", "authentik Crypto"),
108                            ("authentik.flows", "authentik Flows"),
109                            ("authentik.outposts", "authentik Outpost"),
110                            ("authentik.lib", "authentik lib"),
111                            ("authentik.policies", "authentik Policies"),
112                            ("authentik.policies.dummy", "authentik Policies.Dummy"),
113                            (
114                                "authentik.policies.event_matcher",
115                                "authentik Policies.Event Matcher",
116                            ),
117                            ("authentik.policies.expiry", "authentik Policies.Expiry"),
118                            ("authentik.policies.expression", "authentik Policies.Expression"),
119                            ("authentik.policies.hibp", "authentik Policies.HaveIBeenPwned"),
120                            ("authentik.policies.password", "authentik Policies.Password"),
121                            ("authentik.policies.reputation", "authentik Policies.Reputation"),
122                            ("authentik.providers.proxy", "authentik Providers.Proxy"),
123                            ("authentik.providers.ldap", "authentik Providers.LDAP"),
124                            ("authentik.providers.oauth2", "authentik Providers.OAuth2"),
125                            ("authentik.providers.saml", "authentik Providers.SAML"),
126                            ("authentik.recovery", "authentik Recovery"),
127                            ("authentik.sources.ldap", "authentik Sources.LDAP"),
128                            ("authentik.sources.oauth", "authentik Sources.OAuth"),
129                            ("authentik.sources.plex", "authentik Sources.Plex"),
130                            ("authentik.sources.saml", "authentik Sources.SAML"),
131                            (
132                                "authentik.stages.authenticator_duo",
133                                "authentik Stages.Authenticator.Duo",
134                            ),
135                            (
136                                "authentik.stages.authenticator_static",
137                                "authentik Stages.Authenticator.Static",
138                            ),
139                            (
140                                "authentik.stages.authenticator_totp",
141                                "authentik Stages.Authenticator.TOTP",
142                            ),
143                            (
144                                "authentik.stages.authenticator_validate",
145                                "authentik Stages.Authenticator.Validate",
146                            ),
147                            (
148                                "authentik.stages.authenticator_webauthn",
149                                "authentik Stages.Authenticator.WebAuthn",
150                            ),
151                            ("authentik.stages.captcha", "authentik Stages.Captcha"),
152                            ("authentik.stages.consent", "authentik Stages.Consent"),
153                            ("authentik.stages.deny", "authentik Stages.Deny"),
154                            ("authentik.stages.dummy", "authentik Stages.Dummy"),
155                            ("authentik.stages.email", "authentik Stages.Email"),
156                            ("authentik.stages.identification", "authentik Stages.Identification"),
157                            ("authentik.stages.invitation", "authentik Stages.User Invitation"),
158                            ("authentik.stages.password", "authentik Stages.Password"),
159                            ("authentik.stages.prompt", "authentik Stages.Prompt"),
160                            ("authentik.stages.user_delete", "authentik Stages.User Delete"),
161                            ("authentik.stages.user_login", "authentik Stages.User Login"),
162                            ("authentik.stages.user_logout", "authentik Stages.User Logout"),
163                            ("authentik.stages.user_write", "authentik Stages.User Write"),
164                            ("authentik.brands", "authentik Brands"),
165                            ("authentik.core", "authentik Core"),
166                            ("authentik.blueprints", "authentik Blueprints"),
167                        ],
168                        default="",
169                        help_text=(
170                            "Match events created by selected application. When left empty, all"
171                            " applications are matched."
172                        ),
173                    ),
174                ),
175            ],
176            options={
177                "verbose_name": "Event Matcher Policy",
178                "verbose_name_plural": "Event Matcher Policies",
179            },
180            bases=("authentik_policies.policy",),
181        ),
182    ]
class Migration(django.db.migrations.migration.Migration):
  8class Migration(migrations.Migration):
  9    replaces = [
 10        ("authentik_policies_event_matcher", "0001_initial"),
 11        ("authentik_policies_event_matcher", "0002_auto_20201230_2046"),
 12        ("authentik_policies_event_matcher", "0003_auto_20210110_1907"),
 13        ("authentik_policies_event_matcher", "0004_auto_20210112_2158"),
 14        ("authentik_policies_event_matcher", "0005_auto_20210202_1821"),
 15        ("authentik_policies_event_matcher", "0006_auto_20210203_1134"),
 16        ("authentik_policies_event_matcher", "0007_auto_20210209_1657"),
 17        ("authentik_policies_event_matcher", "0008_auto_20210213_1640"),
 18        ("authentik_policies_event_matcher", "0009_auto_20210215_2159"),
 19        ("authentik_policies_event_matcher", "0010_auto_20210222_1821"),
 20        ("authentik_policies_event_matcher", "0011_auto_20210302_0856"),
 21        ("authentik_policies_event_matcher", "0012_auto_20210323_1339"),
 22        ("authentik_policies_event_matcher", "0013_alter_eventmatcherpolicy_app"),
 23        ("authentik_policies_event_matcher", "0014_alter_eventmatcherpolicy_app"),
 24        ("authentik_policies_event_matcher", "0015_alter_eventmatcherpolicy_app"),
 25        ("authentik_policies_event_matcher", "0016_alter_eventmatcherpolicy_action"),
 26        ("authentik_policies_event_matcher", "0017_alter_eventmatcherpolicy_action"),
 27        ("authentik_policies_event_matcher", "0018_alter_eventmatcherpolicy_action"),
 28    ]
 29
 30    initial = True
 31
 32    dependencies = [
 33        ("authentik_policies", "0004_policy_execution_logging"),
 34    ]
 35
 36    operations = [
 37        migrations.CreateModel(
 38            name="EventMatcherPolicy",
 39            fields=[
 40                (
 41                    "policy_ptr",
 42                    models.OneToOneField(
 43                        auto_created=True,
 44                        on_delete=django.db.models.deletion.CASCADE,
 45                        parent_link=True,
 46                        primary_key=True,
 47                        serialize=False,
 48                        to="authentik_policies.policy",
 49                    ),
 50                ),
 51                (
 52                    "action",
 53                    models.TextField(
 54                        blank=True,
 55                        choices=[
 56                            ("login", "Login"),
 57                            ("login_failed", "Login Failed"),
 58                            ("logout", "Logout"),
 59                            ("user_write", "User Write"),
 60                            ("suspicious_request", "Suspicious Request"),
 61                            ("password_set", "Password Set"),
 62                            ("secret_view", "Secret View"),
 63                            ("secret_rotate", "Secret Rotate"),
 64                            ("invitation_used", "Invite Used"),
 65                            ("authorize_application", "Authorize Application"),
 66                            ("source_linked", "Source Linked"),
 67                            ("impersonation_started", "Impersonation Started"),
 68                            ("impersonation_ended", "Impersonation Ended"),
 69                            ("flow_execution", "Flow Execution"),
 70                            ("policy_execution", "Policy Execution"),
 71                            ("policy_exception", "Policy Exception"),
 72                            ("property_mapping_exception", "Property Mapping Exception"),
 73                            ("system_task_execution", "System Task Execution"),
 74                            ("system_task_exception", "System Task Exception"),
 75                            ("system_exception", "System Exception"),
 76                            ("configuration_error", "Configuration Error"),
 77                            ("model_created", "Model Created"),
 78                            ("model_updated", "Model Updated"),
 79                            ("model_deleted", "Model Deleted"),
 80                            ("email_sent", "Email Sent"),
 81                            ("update_available", "Update Available"),
 82                            ("custom_", "Custom Prefix"),
 83                        ],
 84                        help_text=(
 85                            "Match created events with this action type. When left empty, all"
 86                            " action types will be matched."
 87                        ),
 88                    ),
 89                ),
 90                (
 91                    "client_ip",
 92                    models.TextField(
 93                        blank=True,
 94                        help_text=(
 95                            "Matches Event's Client IP (strict matching, for network matching use"
 96                            " an Expression Policy)"
 97                        ),
 98                    ),
 99                ),
100                (
101                    "app",
102                    models.TextField(
103                        blank=True,
104                        choices=[
105                            ("authentik.admin", "authentik Admin"),
106                            ("authentik.api", "authentik API"),
107                            ("authentik.events", "authentik Events"),
108                            ("authentik.crypto", "authentik Crypto"),
109                            ("authentik.flows", "authentik Flows"),
110                            ("authentik.outposts", "authentik Outpost"),
111                            ("authentik.lib", "authentik lib"),
112                            ("authentik.policies", "authentik Policies"),
113                            ("authentik.policies.dummy", "authentik Policies.Dummy"),
114                            (
115                                "authentik.policies.event_matcher",
116                                "authentik Policies.Event Matcher",
117                            ),
118                            ("authentik.policies.expiry", "authentik Policies.Expiry"),
119                            ("authentik.policies.expression", "authentik Policies.Expression"),
120                            ("authentik.policies.hibp", "authentik Policies.HaveIBeenPwned"),
121                            ("authentik.policies.password", "authentik Policies.Password"),
122                            ("authentik.policies.reputation", "authentik Policies.Reputation"),
123                            ("authentik.providers.proxy", "authentik Providers.Proxy"),
124                            ("authentik.providers.ldap", "authentik Providers.LDAP"),
125                            ("authentik.providers.oauth2", "authentik Providers.OAuth2"),
126                            ("authentik.providers.saml", "authentik Providers.SAML"),
127                            ("authentik.recovery", "authentik Recovery"),
128                            ("authentik.sources.ldap", "authentik Sources.LDAP"),
129                            ("authentik.sources.oauth", "authentik Sources.OAuth"),
130                            ("authentik.sources.plex", "authentik Sources.Plex"),
131                            ("authentik.sources.saml", "authentik Sources.SAML"),
132                            (
133                                "authentik.stages.authenticator_duo",
134                                "authentik Stages.Authenticator.Duo",
135                            ),
136                            (
137                                "authentik.stages.authenticator_static",
138                                "authentik Stages.Authenticator.Static",
139                            ),
140                            (
141                                "authentik.stages.authenticator_totp",
142                                "authentik Stages.Authenticator.TOTP",
143                            ),
144                            (
145                                "authentik.stages.authenticator_validate",
146                                "authentik Stages.Authenticator.Validate",
147                            ),
148                            (
149                                "authentik.stages.authenticator_webauthn",
150                                "authentik Stages.Authenticator.WebAuthn",
151                            ),
152                            ("authentik.stages.captcha", "authentik Stages.Captcha"),
153                            ("authentik.stages.consent", "authentik Stages.Consent"),
154                            ("authentik.stages.deny", "authentik Stages.Deny"),
155                            ("authentik.stages.dummy", "authentik Stages.Dummy"),
156                            ("authentik.stages.email", "authentik Stages.Email"),
157                            ("authentik.stages.identification", "authentik Stages.Identification"),
158                            ("authentik.stages.invitation", "authentik Stages.User Invitation"),
159                            ("authentik.stages.password", "authentik Stages.Password"),
160                            ("authentik.stages.prompt", "authentik Stages.Prompt"),
161                            ("authentik.stages.user_delete", "authentik Stages.User Delete"),
162                            ("authentik.stages.user_login", "authentik Stages.User Login"),
163                            ("authentik.stages.user_logout", "authentik Stages.User Logout"),
164                            ("authentik.stages.user_write", "authentik Stages.User Write"),
165                            ("authentik.brands", "authentik Brands"),
166                            ("authentik.core", "authentik Core"),
167                            ("authentik.blueprints", "authentik Blueprints"),
168                        ],
169                        default="",
170                        help_text=(
171                            "Match events created by selected application. When left empty, all"
172                            " applications are matched."
173                        ),
174                    ),
175                ),
176            ],
177            options={
178                "verbose_name": "Event Matcher Policy",
179                "verbose_name_plural": "Event Matcher Policies",
180            },
181            bases=("authentik_policies.policy",),
182        ),
183    ]

The base class for all migrations.

Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:

  • operations: A list of Operation instances, probably from django.db.migrations.operations
  • dependencies: A list of tuples of (app_path, migration_name)
  • run_before: A list of tuples of (app_path, migration_name)
  • replaces: A list of migration_names

Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.

replaces = [('authentik_policies_event_matcher', '0001_initial'), ('authentik_policies_event_matcher', '0002_auto_20201230_2046'), ('authentik_policies_event_matcher', '0003_auto_20210110_1907'), ('authentik_policies_event_matcher', '0004_auto_20210112_2158'), ('authentik_policies_event_matcher', '0005_auto_20210202_1821'), ('authentik_policies_event_matcher', '0006_auto_20210203_1134'), ('authentik_policies_event_matcher', '0007_auto_20210209_1657'), ('authentik_policies_event_matcher', '0008_auto_20210213_1640'), ('authentik_policies_event_matcher', '0009_auto_20210215_2159'), ('authentik_policies_event_matcher', '0010_auto_20210222_1821'), ('authentik_policies_event_matcher', '0011_auto_20210302_0856'), ('authentik_policies_event_matcher', '0012_auto_20210323_1339'), ('authentik_policies_event_matcher', '0013_alter_eventmatcherpolicy_app'), ('authentik_policies_event_matcher', '0014_alter_eventmatcherpolicy_app'), ('authentik_policies_event_matcher', '0015_alter_eventmatcherpolicy_app'), ('authentik_policies_event_matcher', '0016_alter_eventmatcherpolicy_action'), ('authentik_policies_event_matcher', '0017_alter_eventmatcherpolicy_action'), ('authentik_policies_event_matcher', '0018_alter_eventmatcherpolicy_action')]
initial = True
dependencies = [('authentik_policies', '0004_policy_execution_logging')]
operations = [<CreateModel name='EventMatcherPolicy', fields=[('policy_ptr', <django.db.models.fields.related.OneToOneField>), ('action', <django.db.models.fields.TextField>), ('client_ip', <django.db.models.fields.TextField>), ('app', <django.db.models.fields.TextField>)], options={'verbose_name': 'Event Matcher Policy', 'verbose_name_plural': 'Event Matcher Policies'}, bases=('authentik_policies.policy',)>]