[docs]defis_enabled()->bool:"""Returns True if the auto-generated PKI is enabled."""returnSecurityConfig.objects.first().auto_gen_pki
@staticmethod
[docs]defenable(key_alg:AutoGenPkiKeyAlgorithm)->None:"""Starts a thread that enables the auto-generated PKI.Pass thread arguments as a tuple to avoid any issues."""if__class__.is_enabled():thread=threading.Thread(target=AutoGenPki.enable_auto_gen_pki,args=(key_alg,))thread.start()
@staticmethod
[docs]defdisable()->None:"""Starts a thread that disables the auto-generated PKI."""thread=threading.Thread(target=AutoGenPki.disable_auto_gen_pki)thread.start()conf=SecurityConfig.objects.first()conf.auto_gen_pki=Falseconf.save()