feat: Set the default expiration days for adding user and asset permissions

This commit is contained in:
ewall555
2025-05-12 11:41:58 +08:00
committed by 老广
parent bd0c50a3e4
commit a88ebeff15
6 changed files with 25 additions and 4 deletions

View File

@@ -51,6 +51,21 @@ def date_expired_default():
years = 70
return timezone.now() + timezone.timedelta(days=365 * years)
def user_date_expired_default():
try:
days = int(settings.USER_DEFAULT_EXPIRED_DAYS)
except TypeError:
days = 25550
return timezone.now() + timezone.timedelta(days=days)
def asset_permission_date_expired_default():
try:
days = int(settings.ASSET_PERMISSION_DEFAULT_EXPIRED_DAYS)
except TypeError:
days = 25550
return timezone.now() + timezone.timedelta(days=days)
def union_queryset(*args, base_queryset=None):
if len(args) == 1: