From dd1286135e66da3b51eb225fb616be52e1eae526 Mon Sep 17 00:00:00 2001 From: Kevin_Zheng Date: Wed, 22 Mar 2017 17:15:56 +0800 Subject: [PATCH] Add description to policies in keypairs.py blueprint policy-docs Change-Id: I4a36b76626ca580522c953170327478c72be9556 --- nova/policies/keypairs.py | 52 ++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/nova/policies/keypairs.py b/nova/policies/keypairs.py index 0cf7372d91..f55cf1c1d6 100644 --- a/nova/policies/keypairs.py +++ b/nova/policies/keypairs.py @@ -26,18 +26,46 @@ keypairs_policies = [ policy.RuleDefault( name=POLICY_ROOT % 'discoverable', check_str=base.RULE_ANY), - policy.RuleDefault( - name=POLICY_ROOT % 'index', - check_str='rule:admin_api or user_id:%(user_id)s'), - policy.RuleDefault( - name=POLICY_ROOT % 'create', - check_str='rule:admin_api or user_id:%(user_id)s'), - policy.RuleDefault( - name=POLICY_ROOT % 'delete', - check_str='rule:admin_api or user_id:%(user_id)s'), - policy.RuleDefault( - name=POLICY_ROOT % 'show', - check_str='rule:admin_api or user_id:%(user_id)s'), + base.create_rule_default( + POLICY_ROOT % 'index', + 'rule:admin_api or user_id:%(user_id)s', + "List all keypairs", + [ + { + 'path': '/os-keypairs', + 'method': 'GET' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'create', + 'rule:admin_api or user_id:%(user_id)s', + "Create a keypair", + [ + { + 'path': '/os-keypairs', + 'method': 'POST' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'delete', + 'rule:admin_api or user_id:%(user_id)s', + "Delete a keypair", + [ + { + 'path': '/os-keypairs/{keypair_name}', + 'method': 'DELETE' + } + ]), + base.create_rule_default( + POLICY_ROOT % 'show', + 'rule:admin_api or user_id:%(user_id)s', + "Show details of a keypair", + [ + { + 'path': '/os-keypairs/{keypair_name}', + 'method': 'GET' + } + ]), policy.RuleDefault( name=BASE_POLICY_NAME, check_str=base.RULE_ADMIN_OR_OWNER),