
on 2014/01/21 00:44, Aline Manera wrote:
On 01/20/2014 04:00 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
set authentication automatically
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- src/kimchi/server.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/kimchi/server.py b/src/kimchi/server.py index b820263..d44a5a0 100644 --- a/src/kimchi/server.py +++ b/src/kimchi/server.py @@ -35,6 +35,7 @@ from kimchi import mockmodel from kimchi import vnc from kimchi.root import Root from kimchi.utils import get_enabled_plugins, import_class +from kimchi.control import sub_nodes
LOGGING_LEVEL = {"debug": logging.DEBUG, @@ -74,13 +75,6 @@ class Server(object): 'tools.sessions.storage_type': 'file', 'tools.sessions.storage_path': config.get_session_path(), 'tools.kimchiauth.on': False}, - '/host': {'tools.kimchiauth.on': True}, - '/vms': {'tools.kimchiauth.on': True}, - '/templates': {'tools.kimchiauth.on': True}, - '/networks': {'tools.kimchiauth.on': True}, - '/storagepools': {'tools.kimchiauth.on': True}, - '/tasks': {'tools.kimchiauth.on': True}, - '/debugreports': {'tools.kimchiauth.on': True}, '/css': { 'tools.staticdir.on': True, 'tools.staticdir.dir': 'ui/css', @@ -193,6 +187,10 @@ class Server(object): vnc_ws_proxy = vnc.new_ws_proxy() cherrypy.engine.subscribe('exit', vnc_ws_proxy.kill)
+ for ident, node in sub_nodes.items(): + if node._url_sub_node_auth:
If you would like to access _url_sub_node_auth outside its class you should made it public
node.url_sub_node_auth
I partly agree. I think "_url_sub_node_auth" is not part of the "normal" public interface, and it's not related to any of the controller responsibilities. It's implementation detail. It's also true we have to visit it outside the class, so we'd better create a "auth" property method to wrap "_url_sub_node_auth" inside the class, and have the function who generated the "_url_sub_node_auth" also generate a "auth" property method.
+ self.configObj["/%s" % ident] = {'tools.kimchiauth.on': True} + self.app = cherrypy.tree.mount(Root(model_instance, dev_env), config=self.configObj) self._load_plugins()
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Thanks and best regards! Zhou Zheng Sheng / 周征晟 E-mail: zhshzhou@linux.vnet.ibm.com Telephone: 86-10-82454397