Beispiel #1
0
def system_configuration(request):
    context = {
        'system_name':
        license.get_system_config('system_name') or '',
        'copyright':
        license.get_system_config('copyright') or '',
        'person_env_count':
        license.get_system_config('person_env_count') or '',
        'public_register':
        license.get_system_config('public_register') or '',
        'audit':
        license.get_system_config('audit') or '',
        'version':
        license.get_system_config('version')
        or license.get_version("system_configuration"),
        'answer_prefix':
        license.get_system_config('answer_prefix') or '',
        'desktop_transmission_quality':
        license.get_system_config('desktop_transmission_quality')
        or SystemConfiguration.DesktopTransmissionQuality.MIDDLE,
    }

    logo = license.get_system_config('logo')
    if logo:
        system_logo_path = os.path.join(settings.MEDIA_URL, 'system_logo')
        context['logo'] = os.path.join(system_logo_path, logo)
    else:
        context['logo'] = ''

    return render(request, 'system_configuration.html', context)
Beispiel #2
0
def get_edition():
    if not settings.DEBUG:
        if not get_system_config('edition'):
            return 1
        else:
            edition = int(get_system_config('edition'))
            if edition == Edition.PROFESSION:
                return 1
            if edition == Edition.EDUCATION:
                return 0
    return 0
    def process_request(self, request):

        load_log_config()
        request.system_name = license.get_system_config('system_name')
        request.platform_logo = license.get_system_config('logo')
        request.copyright = license.get_system_config('copyright')
        request.trial = license.get_system_config('trial')

        if DEBUG:
            return None

        if request.path == reverse('common_web:license_upload'):
            return None

        license_can_use = cache.get("license_expired")

        if license_can_use is not None and license_can_use:
            return None

        # 判断是否过期
        can_use = True
        deadline = license.get_system_config('deadline_time')
        if deadline:
            t = time.strptime(deadline, "%Y-%m-%d %H:%M:%S")
            y, m, d, h, M, s = t[0:6]
            deadline = datetime.datetime(y, m, d, h, M, s)
            if deadline > timezone.now():
                cache.set("license_expired", can_use, 24 * 60 * 60)
                return None

        personal_license_path = os.path.join(settings.MEDIA_ROOT, 'personal_license')
        license_name = "license.zip"
        personal_license_full_path = os.path.join(personal_license_path, license_name)

        # 根据license文件判断
        errcode, info = License().judge_authorize(personal_license_full_path)
        if errcode != 0:
            can_use = False

            # 返回授权页面
            if request.path != reverse('common_web:authorization'):
                return redirect(reverse('common_web:authorization'))

        cache.set("license_expired", can_use, 24 * 60 * 60)
        return None
Beispiel #4
0
def get_license(request):
    context = {}

    terminal_node_number = license.get_system_config('terminal_node_number')
    if terminal_node_number is not None:
        context['terminal_node_number'] = _(
            "x_not_limited"
        ) if terminal_node_number == 0 else terminal_node_number
    else:
        context['terminal_node_number'] = 2

    context['all_env_count'] = license.get_system_config(
        'all_env_count') or '0'
    context['deadline_time'] = license.get_system_config('deadline_time') or ''
    context['version'] = license.get_system_config(
        'version') or license.get_version("system_configuration")

    return render(request, 'license.html', context)
Beispiel #5
0
 def __init__(self, user, server=None):
     self.user = user
     self.user_id = user.id
     self.username = user.username
     self.password = user.password
     self.db = GuacamoleDatabase()
     self.server = GuacamoleServer(server)
     self._check_user()
     self.desktop_transmission_quality = license.get_system_config(
         'desktop_transmission_quality'
     ) or SystemConfiguration.DesktopTransmissionQuality.MIDDLE
Beispiel #6
0
def login(request):
    context = {}
    # if SystemConfiguration.objects.filter(key='public_register').exists():
    #     public_register = SystemConfiguration.objects.filter(key='public_register').first().value
    #     context['public_register'] = int(public_register)
    public_register = license.get_system_config("public_register")
    if public_register:
        context['public_register'] = 1 if int(public_register) != 0 else 0
    else:
        context["public_register"] = 0
    next = request.GET.get('next', '/')
    context['next'] = next
    context['show_notice'] = api_settings.SHOW_NOTICE

    return render(request, 'web/login.html', context)