2020-04-29 03:08:09 +00:00
|
|
|
# coding: utf-8
|
2021-10-22 12:06:16 +00:00
|
|
|
from jumpserver.context_processor import default_interface
|
|
|
|
from django.conf import settings
|
2020-04-29 03:08:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ObjectDict(dict):
|
|
|
|
def __getattr__(self, name):
|
|
|
|
if name in self:
|
|
|
|
return self[name]
|
|
|
|
else:
|
|
|
|
raise AttributeError("No such attribute: " + name)
|
|
|
|
|
|
|
|
def __setattr__(self, name, value):
|
|
|
|
self[name] = value
|
|
|
|
|
|
|
|
def __delattr__(self, name):
|
|
|
|
if name in self:
|
|
|
|
del self[name]
|
|
|
|
else:
|
|
|
|
raise AttributeError("No such attribute: " + name)
|
2021-10-22 12:06:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
def get_interface_setting():
|
|
|
|
if not settings.XPACK_ENABLED:
|
|
|
|
return default_interface
|
|
|
|
from xpack.plugins.interface.models import Interface
|
|
|
|
return Interface.get_interface_setting()
|
|
|
|
|
|
|
|
|
|
|
|
def get_login_title():
|
|
|
|
return get_interface_setting()['login_title']
|