[Kimchi-devel] [PATCH 4/5] authorization: Add "access" parameter to VM resource

Daniel H Barboza danielhb at linux.vnet.ibm.com
Thu Jul 17 17:40:06 UTC 2014


Reviewed-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>
Tested-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>

On 07/16/2014 06:52 PM, alinefm at linux.vnet.ibm.com wrote:
> From: Aline Manera <alinefm at linux.vnet.ibm.com>
>
> As the guests tab has by-instance mode when a normal user is logged into
> Kimchi, each VM resource must specify the user access.
> By now, if a user has access to a VM he/she will have full access to it
> so add "access=full".
>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>   src/kimchi/mockmodel.py | 3 ++-
>   src/kimchi/model/vms.py | 3 ++-
>   tests/test_mockmodel.py | 3 ++-
>   tests/test_model.py     | 3 ++-
>   4 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
> index d1cec70..0e45d1e 100644
> --- a/src/kimchi/mockmodel.py
> +++ b/src/kimchi/mockmodel.py
> @@ -1050,7 +1050,8 @@ def __init__(self, uuid, name, template_info):
>                        'graphics': {'type': 'vnc', 'listen': '0.0.0.0',
>                                     'port': None},
>                        'users': ['user1', 'user2', 'root'],
> -                     'groups': ['group1', 'group2', 'admin']
> +                     'groups': ['group1', 'group2', 'admin'],
> +                     'access': 'full'
>                        }
>           self.info['graphics'].update(template_info['graphics'])
>
> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
> index 17bda04..8c0dcb1 100644
> --- a/src/kimchi/model/vms.py
> +++ b/src/kimchi/model/vms.py
> @@ -395,7 +395,8 @@ def lookup(self, name):
>                                "listen": graphics_listen,
>                                "port": graphics_port},
>                   'users': users,
> -                'groups': groups
> +                'groups': groups,
> +                'access': 'full'
>                   }
>
>       def _vm_get_disk_paths(self, dom):
> diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
> index d43d37c..e04b740 100644
> --- a/tests/test_mockmodel.py
> +++ b/tests/test_mockmodel.py
> @@ -138,7 +138,8 @@ def test_vm_info(self):
>           self.assertEquals(u'test', vms[0])
>
>           keys = set(('name', 'state', 'stats', 'uuid', 'memory', 'cpus',
> -                    'screenshot', 'icon', 'graphics', 'users', 'groups'))
> +                    'screenshot', 'icon', 'graphics', 'users', 'groups',
> +                    'access'))
>
>           stats_keys = set(('cpu_utilization',
>                             'net_throughput', 'net_throughput_peak',
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 2c77514..30daafa 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -63,7 +63,8 @@ def test_vm_info(self):
>           self.assertEquals('test', vms[0])
>
>           keys = set(('name', 'state', 'stats', 'uuid', 'memory', 'cpus',
> -                    'screenshot', 'icon', 'graphics', 'users', 'groups'))
> +                    'screenshot', 'icon', 'graphics', 'users', 'groups',
> +                    'access'))
>
>           stats_keys = set(('cpu_utilization',
>                             'net_throughput', 'net_throughput_peak',




More information about the Kimchi-devel mailing list