forked from CGM_Public/pretix_original
Disable scopes for all unique ID generation
This commit is contained in:
@@ -4,11 +4,12 @@ from django.db import models
|
|||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django_scopes import ScopedManager
|
from django_scopes import ScopedManager, scopes_disabled
|
||||||
|
|
||||||
from pretix.base.models import LoggedModel
|
from pretix.base.models import LoggedModel
|
||||||
|
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def generate_serial():
|
def generate_serial():
|
||||||
serial = get_random_string(allowed_chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', length=16)
|
serial = get_random_string(allowed_chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', length=16)
|
||||||
while Device.objects.filter(unique_serial=serial).exists():
|
while Device.objects.filter(unique_serial=serial).exists():
|
||||||
@@ -16,6 +17,7 @@ def generate_serial():
|
|||||||
return serial
|
return serial
|
||||||
|
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def generate_initialization_token():
|
def generate_initialization_token():
|
||||||
token = get_random_string(length=16, allowed_chars=string.ascii_lowercase + string.digits)
|
token = get_random_string(length=16, allowed_chars=string.ascii_lowercase + string.digits)
|
||||||
while Device.objects.filter(initialization_token=token).exists():
|
while Device.objects.filter(initialization_token=token).exists():
|
||||||
@@ -23,6 +25,7 @@ def generate_initialization_token():
|
|||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def generate_api_token():
|
def generate_api_token():
|
||||||
token = get_random_string(length=64, allowed_chars=string.ascii_lowercase + string.digits)
|
token = get_random_string(length=64, allowed_chars=string.ascii_lowercase + string.digits)
|
||||||
while Device.objects.filter(api_token=token).exists():
|
while Device.objects.filter(api_token=token).exists():
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from django.utils.crypto import get_random_string
|
|||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.timezone import make_aware, now
|
from django.utils.timezone import make_aware, now
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django_scopes import ScopedManager
|
from django_scopes import ScopedManager, scopes_disabled
|
||||||
from i18nfield.fields import I18nCharField, I18nTextField
|
from i18nfield.fields import I18nCharField, I18nTextField
|
||||||
|
|
||||||
from pretix.base.models.base import LoggedModel
|
from pretix.base.models.base import LoggedModel
|
||||||
@@ -946,6 +946,7 @@ class SubEvent(EventMixin, LoggedModel):
|
|||||||
raise ValidationError(_('One or more variations do not belong to this event.'))
|
raise ValidationError(_('One or more variations do not belong to this event.'))
|
||||||
|
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def generate_invite_token():
|
def generate_invite_token():
|
||||||
return get_random_string(length=32, allowed_chars=string.ascii_lowercase + string.digits)
|
return get_random_string(length=32, allowed_chars=string.ascii_lowercase + string.digits)
|
||||||
|
|
||||||
|
|||||||
@@ -1857,6 +1857,7 @@ class OrderPosition(AbstractPosition):
|
|||||||
|
|
||||||
return super().save(*args, **kwargs)
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def assign_pseudonymization_id(self):
|
def assign_pseudonymization_id(self):
|
||||||
# This omits some character pairs completely because they are hard to read even on screens (1/I and O/0)
|
# This omits some character pairs completely because they are hard to read even on screens (1/I and O/0)
|
||||||
# and includes only one of two characters for some pairs because they are sometimes hard to distinguish in
|
# and includes only one of two characters for some pairs because they are sometimes hard to distinguish in
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from django.db.models import Q
|
|||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
|
||||||
from django_scopes import ScopedManager
|
from django_scopes import ScopedManager, scopes_disabled
|
||||||
|
|
||||||
from ..decimal import round_decimal
|
from ..decimal import round_decimal
|
||||||
from .base import LoggedModel
|
from .base import LoggedModel
|
||||||
@@ -24,6 +24,7 @@ def _generate_random_code(prefix=None):
|
|||||||
return get_random_string(length=settings.ENTROPY['voucher_code'], allowed_chars=charset)
|
return get_random_string(length=settings.ENTROPY['voucher_code'], allowed_chars=charset)
|
||||||
|
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def generate_code(prefix=None):
|
def generate_code(prefix=None):
|
||||||
while True:
|
while True:
|
||||||
code = _generate_random_code(prefix=prefix)
|
code = _generate_random_code(prefix=prefix)
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ class CartActionMixin:
|
|||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
||||||
|
@scopes_disabled()
|
||||||
def generate_cart_id(request=None, prefix=''):
|
def generate_cart_id(request=None, prefix=''):
|
||||||
"""
|
"""
|
||||||
Generates a random new cart ID that is not currently in use, with an optional pretix.
|
Generates a random new cart ID that is not currently in use, with an optional pretix.
|
||||||
|
|||||||
Reference in New Issue
Block a user