def getCurrentLicense(self): # Test current license... with request_context_safety(): context['translate'] = lambda x: x lic, sig = getSupportLicenseInfo() isSupportLicenseValid(lic_dict=lic, lic_sign=sig, raiseException=True) return lic, sig
def is_support_valid(filename): """checks if the linotp support info is valid similar to isSupportValid""" try: _setup_security_context() session = db.session() if filename: with open(filename, "rb") as license_file: license_text = license_file.read() license_text = license_text.decode("utf-8").replace("\n", "\n") license_dict, license_signature = parseSupportLicense(license_text) else: license_dict, license_signature = getSupportLicenseInfo() valid = isSupportLicenseValid( lic_dict=license_dict, lic_sign=license_signature, raiseException=True, ) session.close() except InvalidLicenseException as exx: current_app.echo(f"Invalid License: {exx}") sys.exit(2) except Exception as exx: current_app.echo(f"Validating support could not be completed: {exx}") sys.exit(1) if not license_dict: if isinstance(license_dict, dict): current_app.echo("No support license installed") else: current_app.echo("Validating support failed!") sys.exit(2) if not valid or not isinstance(valid, tuple): current_app.echo("Validating support error: %r" % valid) sys.exit(2) print(valid[0]) sys.exit(0)
def getCurrentLicense(self): # Test current license... lic, sig = getSupportLicenseInfo() isSupportLicenseValid(lic_dict=lic, lic_sign=sig, raiseException=True) return (lic, sig)
def getCurrentLicense(self): # Test current license... lic, sig = getSupportLicenseInfo() isSupportLicenseValid(lic_dict=lic, lic_sign=sig, raiseException=True) return lic, sig