[Kimchi-devel] [PATCH 4/4] improve controller: set authentication automatically

Aline Manera alinefm at linux.vnet.ibm.com
Mon Jan 20 16:44:30 UTC 2014


On 01/20/2014 04:00 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> set authentication automatically
>
> Signed-off-by: ShaoHe Feng <shaohef at 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

> +                self.configObj["/%s" % ident] = {'tools.kimchiauth.on': True}
> +
>           self.app = cherrypy.tree.mount(Root(model_instance, dev_env),
>                                          config=self.configObj)
>           self._load_plugins()




More information about the Kimchi-devel mailing list