mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-08-21 14:37:16 +00:00
Added move clients feature
This commit is contained in:
@@ -52,8 +52,15 @@ class ACL(models.Model):
|
||||
return f"{self.user.username} - {self.server.name}"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
# Check if this is a new ACL and if auto_create_link should be enabled
|
||||
is_new = self.pk is None
|
||||
auto_create_link = kwargs.pop('auto_create_link', True)
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
if not self.links.exists():
|
||||
|
||||
# Only create default link for new ACLs when auto_create_link is True
|
||||
# This happens when ACL is created through admin interface or initial user setup
|
||||
if is_new and auto_create_link and not self.links.exists():
|
||||
ACLLink.objects.create(acl=self, link=shortuuid.ShortUUID().random(length=16))
|
||||
|
||||
@receiver(post_save, sender=ACL)
|
||||
@@ -76,4 +83,4 @@ class ACLLink(models.Model):
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.link
|
||||
return self.link
|
||||
|
Reference in New Issue
Block a user