示例#1
0
文件: conf.py 项目: zwfec/jumpserver
 def XPACK_LICENSE_IS_VALID(self):
     if not HAS_XPACK:
         return False
     try:
         from xpack.plugins.license.models import License
         return License.has_valid_license()
     except:
         return False
示例#2
0
 def get_xpack_license_is_valid():
     if not settings.XPACK_ENABLED:
         return False
     try:
         from xpack.plugins.license.models import License
         return License.has_valid_license()
     except Exception as e:
         logger.error(e)
         return False
示例#3
0
 def set_action_choices(self):
     from xpack.plugins.license.models import License
     action = self.fields.get('action')
     if not action:
         return
     choices = action._choices
     if not License.has_valid_license():
         choices.pop(LoginACL.ActionChoices.confirm, None)
     action._choices = choices
示例#4
0
def get_xpack_license_info() -> dict:
    if has_valid_xpack_license():
        from xpack.plugins.license.models import License
        info = License.get_license_detail()
        corporation = info.get('corporation', '')
    else:
        current_year = datetime.now().year
        corporation = f'Copyright - FIT2CLOUD 飞致云 © 2014-{current_year}'
    info = {'corporation': corporation}
    return info
示例#5
0
    def get_template_names(self):
        template_name = 'authentication/login.html'
        if not settings.XPACK_ENABLED:
            return template_name

        from xpack.plugins.license.models import License
        if not License.has_valid_license():
            return template_name

        template_name = 'authentication/xpack_login.html'
        return template_name
示例#6
0
    def get_template_names(self):
        template_name = 'users/login.html'
        if not settings.XPACK_ENABLED:
            return template_name

        from xpack.plugins.license.models import License
        if not License.has_valid_license():
            return template_name

        template_name = 'users/new_login.html'
        return template_name
示例#7
0
    def get_xpack_license_is_valid():
        if not settings.XPACK_ENABLED:
            return False

        from xpack.plugins.license.models import License
        return License.has_valid_license()