comparison libervia/server/server.py @ 1287:1f26d8c2afc1

server: restricted_bridge first draft: bridge with a limited set of methods, where arguments are checked or removed, and security_limit is used. This bridge is used for calls from browser.
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 16:47:51 +0200
parents 0e4e413eb8db
children e30e96958fb7
comparison
equal deleted inserted replaced
1286:63328c793a9e 1287:1f26d8c2afc1
60 from libervia.server.tasks.manager import TasksManager 60 from libervia.server.tasks.manager import TasksManager
61 from functools import partial 61 from functools import partial
62 62
63 from libervia.server.constants import Const as C 63 from libervia.server.constants import Const as C
64 from libervia.server import session_iface 64 from libervia.server import session_iface
65 from .restricted_bridge import RestrictedBridge
65 66
66 log = getLogger(__name__) 67 log = getLogger(__name__)
67 68
68 69
69 # following value are set from twisted.plugins.libervia_server initialise 70 # following value are set from twisted.plugins.libervia_server initialise
813 self.media_dir = self.bridge.getConfig("", "media_dir") 814 self.media_dir = self.bridge.getConfig("", "media_dir")
814 self.local_dir = self.bridge.getConfig("", "local_dir") 815 self.local_dir = self.bridge.getConfig("", "local_dir")
815 self.cache_root_dir = os.path.join(self.local_dir, C.CACHE_DIR) 816 self.cache_root_dir = os.path.join(self.local_dir, C.CACHE_DIR)
816 self.renderer = template.Renderer(self, self._front_url_filter) 817 self.renderer = template.Renderer(self, self._front_url_filter)
817 sites_names = list(self.renderer.sites_paths.keys()) 818 sites_names = list(self.renderer.sites_paths.keys())
819 self.restricted_bridge = RestrictedBridge(self)
818 820
819 self._moveFirstLevelToDict(self.options, "url_redirections_dict", sites_names) 821 self._moveFirstLevelToDict(self.options, "url_redirections_dict", sites_names)
820 self._moveFirstLevelToDict(self.options, "menu_json", sites_names) 822 self._moveFirstLevelToDict(self.options, "menu_json", sites_names)
821 if not '' in self.options["menu_json"]: 823 if not '' in self.options["menu_json"]:
822 self.options["menu_json"][''] = C.DEFAULT_MENU 824 self.options["menu_json"][''] = C.DEFAULT_MENU