Skip to content

Commit 9c26e77

Browse files
committed
make license key unique
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
1 parent 05c7fc4 commit 9c26e77

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

authentik/enterprise/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from rest_framework.permissions import IsAuthenticated
1313
from rest_framework.request import Request
1414
from rest_framework.response import Response
15+
from rest_framework.validators import UniqueValidator
1516
from rest_framework.viewsets import ModelViewSet
1617

1718
from authentik.core.api.used_by import UsedByMixin
@@ -53,6 +54,7 @@ class Meta:
5354
"external_users",
5455
]
5556
extra_kwargs = {
57+
"key": {"validators": [UniqueValidator(queryset=License.objects.all())]},
5658
"name": {"read_only": True},
5759
"expiry": {"read_only": True},
5860
"internal_users": {"read_only": True},

0 commit comments

Comments
 (0)