core: bump black from 22.12.0 to 23.1.0 (#4584)
* core: bump black from 22.12.0 to 23.1.0 Bumps [black](https://github.com/psf/black) from 22.12.0 to 23.1.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/22.12.0...23.1.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * re-format Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -63,7 +63,6 @@ class ApplicationSerializer(ModelSerializer): | ||||
|         return app.get_launch_url(user) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Application | ||||
|         fields = [ | ||||
|             "pk", | ||||
|  | ||||
| @ -74,7 +74,6 @@ class AuthenticatedSessionSerializer(ModelSerializer): | ||||
|         return GEOIP_READER.city_dict(instance.last_ip) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = AuthenticatedSession | ||||
|         fields = [ | ||||
|             "uuid", | ||||
|  | ||||
| @ -29,7 +29,6 @@ class GroupMemberSerializer(ModelSerializer): | ||||
|     uid = CharField(read_only=True) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = User | ||||
|         fields = [ | ||||
|             "pk", | ||||
| @ -56,7 +55,6 @@ class GroupSerializer(ModelSerializer): | ||||
|     num_pk = IntegerField(read_only=True) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Group | ||||
|         fields = [ | ||||
|             "pk", | ||||
| @ -114,7 +112,6 @@ class GroupFilter(FilterSet): | ||||
|             return queryset | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Group | ||||
|         fields = ["name", "is_superuser", "members_by_pk", "attributes", "members_by_username"] | ||||
|  | ||||
|  | ||||
| @ -49,7 +49,6 @@ class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSeri | ||||
|         return expression | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = PropertyMapping | ||||
|         fields = [ | ||||
|             "pk", | ||||
|  | ||||
| @ -31,7 +31,6 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): | ||||
|         return obj.component | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Provider | ||||
|         fields = [ | ||||
|             "pk", | ||||
|  | ||||
| @ -46,7 +46,6 @@ class SourceSerializer(ModelSerializer, MetaNameSerializer): | ||||
|         return obj.component | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Source | ||||
|         fields = [ | ||||
|             "pk", | ||||
|  | ||||
| @ -39,7 +39,6 @@ class TokenSerializer(ManagedSerializer, ModelSerializer): | ||||
|         return attrs | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Token | ||||
|         fields = [ | ||||
|             "pk", | ||||
|  | ||||
| @ -84,7 +84,6 @@ class UserGroupSerializer(ModelSerializer): | ||||
|     parent_name = CharField(source="parent.name", read_only=True) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = Group | ||||
|         fields = [ | ||||
|             "pk", | ||||
| @ -120,7 +119,6 @@ class UserSerializer(ModelSerializer): | ||||
|         return path | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = User | ||||
|         fields = [ | ||||
|             "pk", | ||||
| @ -172,7 +170,6 @@ class UserSelfSerializer(ModelSerializer): | ||||
|         return user.group_attributes(self._context["request"]).get("settings", {}) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         model = User | ||||
|         fields = [ | ||||
|             "pk", | ||||
| @ -402,7 +399,7 @@ class UserViewSet(UsedByMixin, ModelViewSet): | ||||
|                 ) | ||||
|                 response["token"] = token.key | ||||
|                 return Response(response) | ||||
|             except (IntegrityError) as exc: | ||||
|             except IntegrityError as exc: | ||||
|                 return Response(data={"non_field_errors": [str(exc)]}, status=400) | ||||
|  | ||||
|     @extend_schema(responses={200: SessionUserSerializer(many=False)}) | ||||
|  | ||||
| @ -14,7 +14,6 @@ import authentik.core.models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     initial = True | ||||
|  | ||||
|     dependencies = [ | ||||
| @ -44,7 +43,10 @@ class Migration(migrations.Migration): | ||||
|                     "is_superuser", | ||||
|                     models.BooleanField( | ||||
|                         default=False, | ||||
|                         help_text="Designates that this user has all permissions without explicitly assigning them.", | ||||
|                         help_text=( | ||||
|                             "Designates that this user has all permissions without explicitly" | ||||
|                             " assigning them." | ||||
|                         ), | ||||
|                         verbose_name="superuser status", | ||||
|                     ), | ||||
|                 ), | ||||
| @ -52,7 +54,9 @@ class Migration(migrations.Migration): | ||||
|                     "username", | ||||
|                     models.CharField( | ||||
|                         error_messages={"unique": "A user with that username already exists."}, | ||||
|                         help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", | ||||
|                         help_text=( | ||||
|                             "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only." | ||||
|                         ), | ||||
|                         max_length=150, | ||||
|                         unique=True, | ||||
|                         validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], | ||||
| @ -83,7 +87,10 @@ class Migration(migrations.Migration): | ||||
|                     "is_active", | ||||
|                     models.BooleanField( | ||||
|                         default=True, | ||||
|                         help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", | ||||
|                         help_text=( | ||||
|                             "Designates whether this user should be treated as active. Unselect" | ||||
|                             " this instead of deleting accounts." | ||||
|                         ), | ||||
|                         verbose_name="active", | ||||
|                     ), | ||||
|                 ), | ||||
|  | ||||
| @ -51,7 +51,6 @@ def create_default_admin_group(apps: Apps, schema_editor: BaseDatabaseSchemaEdit | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     replaces = [ | ||||
|         ("authentik_core", "0002_auto_20200523_1133"), | ||||
|         ("authentik_core", "0003_default_user"), | ||||
| @ -172,7 +171,10 @@ class Migration(migrations.Migration): | ||||
|             name="groups", | ||||
|             field=models.ManyToManyField( | ||||
|                 blank=True, | ||||
|                 help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", | ||||
|                 help_text=( | ||||
|                     "The groups this user belongs to. A user will get all permissions granted to" | ||||
|                     " each of their groups." | ||||
|                 ), | ||||
|                 related_name="user_set", | ||||
|                 related_query_name="user", | ||||
|                 to="auth.Group", | ||||
|  | ||||
| @ -17,7 +17,6 @@ def set_default_token_key(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     replaces = [ | ||||
|         ("authentik_core", "0012_auto_20201003_1737"), | ||||
|         ("authentik_core", "0013_auto_20201003_2132"), | ||||
|  | ||||
| @ -4,7 +4,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0016_auto_20201202_2234"), | ||||
|     ] | ||||
| @ -15,7 +14,12 @@ class Migration(migrations.Migration): | ||||
|             name="managed", | ||||
|             field=models.TextField( | ||||
|                 default=None, | ||||
|                 help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", | ||||
|                 help_text=( | ||||
|                     "Objects which are managed by authentik. These objects are created and updated" | ||||
|                     " automatically. This is flag only indicates that an object can be overwritten" | ||||
|                     " by migrations. You can still modify the objects via the API, but expect" | ||||
|                     " changes to be overwritten in a later update." | ||||
|                 ), | ||||
|                 null=True, | ||||
|                 verbose_name="Managed by authentik", | ||||
|                 unique=True, | ||||
| @ -26,7 +30,12 @@ class Migration(migrations.Migration): | ||||
|             name="managed", | ||||
|             field=models.TextField( | ||||
|                 default=None, | ||||
|                 help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", | ||||
|                 help_text=( | ||||
|                     "Objects which are managed by authentik. These objects are created and updated" | ||||
|                     " automatically. This is flag only indicates that an object can be overwritten" | ||||
|                     " by migrations. You can still modify the objects via the API, but expect" | ||||
|                     " changes to be overwritten in a later update." | ||||
|                 ), | ||||
|                 null=True, | ||||
|                 verbose_name="Managed by authentik", | ||||
|                 unique=True, | ||||
|  | ||||
| @ -63,7 +63,6 @@ def create_default_user_token(apps: Apps, schema_editor: BaseDatabaseSchemaEdito | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     replaces = [ | ||||
|         ("authentik_core", "0018_auto_20210330_1345"), | ||||
|         ("authentik_core", "0019_source_managed"), | ||||
| @ -96,7 +95,12 @@ class Migration(migrations.Migration): | ||||
|             name="managed", | ||||
|             field=models.TextField( | ||||
|                 default=None, | ||||
|                 help_text="Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.", | ||||
|                 help_text=( | ||||
|                     "Objects which are managed by authentik. These objects are created and updated" | ||||
|                     " automatically. This is flag only indicates that an object can be overwritten" | ||||
|                     " by migrations. You can still modify the objects via the API, but expect" | ||||
|                     " changes to be overwritten in a later update." | ||||
|                 ), | ||||
|                 null=True, | ||||
|                 unique=True, | ||||
|                 verbose_name="Managed by authentik", | ||||
| @ -110,23 +114,38 @@ class Migration(migrations.Migration): | ||||
|                     ("identifier", "Use the source-specific identifier"), | ||||
|                     ( | ||||
|                         "email_link", | ||||
|                         "Link to a user with identical email address. Can have security implications when a source doesn't validate email addresses.", | ||||
|                         ( | ||||
|                             "Link to a user with identical email address. Can have security" | ||||
|                             " implications when a source doesn't validate email addresses." | ||||
|                         ), | ||||
|                     ), | ||||
|                     ( | ||||
|                         "email_deny", | ||||
|                         "Use the user's email address, but deny enrollment when the email address already exists.", | ||||
|                         ( | ||||
|                             "Use the user's email address, but deny enrollment when the email" | ||||
|                             " address already exists." | ||||
|                         ), | ||||
|                     ), | ||||
|                     ( | ||||
|                         "username_link", | ||||
|                         "Link to a user with identical username. Can have security implications when a username is used with another source.", | ||||
|                         ( | ||||
|                             "Link to a user with identical username. Can have security implications" | ||||
|                             " when a username is used with another source." | ||||
|                         ), | ||||
|                     ), | ||||
|                     ( | ||||
|                         "username_deny", | ||||
|                         "Use the user's username, but deny enrollment when the username already exists.", | ||||
|                         ( | ||||
|                             "Use the user's username, but deny enrollment when the username already" | ||||
|                             " exists." | ||||
|                         ), | ||||
|                     ), | ||||
|                 ], | ||||
|                 default="identifier", | ||||
|                 help_text="How the source determines if an existing user should be authenticated or a new user enrolled.", | ||||
|                 help_text=( | ||||
|                     "How the source determines if an existing user should be authenticated or a new" | ||||
|                     " user enrolled." | ||||
|                 ), | ||||
|             ), | ||||
|         ), | ||||
|         migrations.AlterField( | ||||
|  | ||||
| @ -4,7 +4,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0018_auto_20210330_1345_squashed_0028_alter_token_intent"), | ||||
|     ] | ||||
|  | ||||
| @ -4,7 +4,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0019_application_group"), | ||||
|     ] | ||||
|  | ||||
| @ -4,7 +4,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0020_application_open_in_new_tab"), | ||||
|     ] | ||||
|  | ||||
| @ -5,7 +5,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0021_source_user_path_user_path"), | ||||
|     ] | ||||
|  | ||||
| @ -4,7 +4,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0022_alter_group_parent"), | ||||
|     ] | ||||
|  | ||||
| @ -4,7 +4,6 @@ from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_core", "0023_source_authentik_c_slug_ccb2e5_idx_and_more"), | ||||
|     ] | ||||
|  | ||||
| @ -129,7 +129,6 @@ class Group(SerializerModel): | ||||
|         return f"Group {self.name}" | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         unique_together = ( | ||||
|             ( | ||||
|                 "name", | ||||
| @ -255,7 +254,6 @@ class User(SerializerModel, GuardianUserMixin, AbstractUser): | ||||
|         } | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         permissions = ( | ||||
|             ("reset_user_password", "Reset Password"), | ||||
|             ("impersonate", "Can impersonate other users"), | ||||
| @ -382,7 +380,6 @@ class Application(SerializerModel, PolicyBindingModel): | ||||
|         return str(self.name) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         verbose_name = _("Application") | ||||
|         verbose_name_plural = _("Applications") | ||||
|  | ||||
| @ -392,19 +389,15 @@ class SourceUserMatchingModes(models.TextChoices): | ||||
|  | ||||
|     IDENTIFIER = "identifier", _("Use the source-specific identifier") | ||||
|     EMAIL_LINK = "email_link", _( | ||||
|         ( | ||||
|             "Link to a user with identical email address. Can have security implications " | ||||
|             "when a source doesn't validate email addresses." | ||||
|         ) | ||||
|         "Link to a user with identical email address. Can have security implications " | ||||
|         "when a source doesn't validate email addresses." | ||||
|     ) | ||||
|     EMAIL_DENY = "email_deny", _( | ||||
|         "Use the user's email address, but deny enrollment when the email address already exists." | ||||
|     ) | ||||
|     USERNAME_LINK = "username_link", _( | ||||
|         ( | ||||
|             "Link to a user with identical username. Can have security implications " | ||||
|             "when a username is used with another source." | ||||
|         ) | ||||
|         "Link to a user with identical username. Can have security implications " | ||||
|         "when a username is used with another source." | ||||
|     ) | ||||
|     USERNAME_DENY = "username_deny", _( | ||||
|         "Use the user's username, but deny enrollment when the username already exists." | ||||
| @ -451,10 +444,8 @@ class Source(ManagedModel, SerializerModel, PolicyBindingModel): | ||||
|         choices=SourceUserMatchingModes.choices, | ||||
|         default=SourceUserMatchingModes.IDENTIFIER, | ||||
|         help_text=_( | ||||
|             ( | ||||
|                 "How the source determines if an existing user should be authenticated or " | ||||
|                 "a new user enrolled." | ||||
|             ) | ||||
|             "How the source determines if an existing user should be authenticated or " | ||||
|             "a new user enrolled." | ||||
|         ), | ||||
|     ) | ||||
|  | ||||
| @ -500,7 +491,6 @@ class Source(ManagedModel, SerializerModel, PolicyBindingModel): | ||||
|         return str(self.name) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         indexes = [ | ||||
|             models.Index( | ||||
|                 fields=[ | ||||
| @ -529,7 +519,6 @@ class UserSourceConnection(SerializerModel, CreatedUpdatedModel): | ||||
|         raise NotImplementedError | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         unique_together = (("user", "source"),) | ||||
|  | ||||
|  | ||||
| @ -562,7 +551,6 @@ class ExpiringModel(models.Model): | ||||
|         return now() > self.expires | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         abstract = True | ||||
|  | ||||
|  | ||||
| @ -628,7 +616,6 @@ class Token(SerializerModel, ManagedModel, ExpiringModel): | ||||
|         return description | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         verbose_name = _("Token") | ||||
|         verbose_name_plural = _("Tokens") | ||||
|         indexes = [ | ||||
| @ -671,7 +658,6 @@ class PropertyMapping(SerializerModel, ManagedModel): | ||||
|         return f"Property Mapping {self.name}" | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         verbose_name = _("Property Mapping") | ||||
|         verbose_name_plural = _("Property Mappings") | ||||
|  | ||||
| @ -708,6 +694,5 @@ class AuthenticatedSession(ExpiringModel): | ||||
|         ) | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
|         verbose_name = _("Authenticated Session") | ||||
|         verbose_name_plural = _("Authenticated Sessions") | ||||
|  | ||||
| @ -190,11 +190,8 @@ class SourceFlowManager: | ||||
|         # Default case, assume deny | ||||
|         error = Exception( | ||||
|             _( | ||||
|                 ( | ||||
|                     "Request to authenticate with %(source)s has been denied. Please authenticate " | ||||
|                     "with the source you've previously signed up with." | ||||
|                 ) | ||||
|                 % {"source": self.source.name} | ||||
|                 "Request to authenticate with %(source)s has been denied. Please authenticate " | ||||
|                 "with the source you've previously signed up with." % {"source": self.source.name} | ||||
|             ), | ||||
|         ) | ||||
|         return self.error_handler(error) | ||||
|  | ||||
| @ -80,7 +80,7 @@ class TestTokenAPI(APITestCase): | ||||
|             identifier="test", expiring=False, user=self.user | ||||
|         ) | ||||
|         Token.objects.create(identifier="test-2", expiring=False, user=get_anonymous_user()) | ||||
|         response = self.client.get(reverse(("authentik_api:token-list"))) | ||||
|         response = self.client.get(reverse("authentik_api:token-list")) | ||||
|         body = loads(response.content) | ||||
|         self.assertEqual(len(body["results"]), 1) | ||||
|         self.assertEqual(body["results"][0]["identifier"], token_should.identifier) | ||||
| @ -94,7 +94,7 @@ class TestTokenAPI(APITestCase): | ||||
|         token_should_not: Token = Token.objects.create( | ||||
|             identifier="test-2", expiring=False, user=get_anonymous_user() | ||||
|         ) | ||||
|         response = self.client.get(reverse(("authentik_api:token-list"))) | ||||
|         response = self.client.get(reverse("authentik_api:token-list")) | ||||
|         body = loads(response.content) | ||||
|         self.assertEqual(len(body["results"]), 2) | ||||
|         self.assertEqual(body["results"][0]["identifier"], token_should.identifier) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	![49699333+dependabot[bot]@users.noreply.github.com](/assets/img/avatar_default.png) dependabot[bot]
					dependabot[bot]