summaryrefslogtreecommitdiffstats
path: root/keystone/policy
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2013-02-07 15:09:18 -0600
committerDolph Mathews <dolph.mathews@gmail.com>2013-02-07 15:56:54 -0600
commit15739739419781128a9994eb28c1ab0ac0bf5e87 (patch)
treea7d41bd744b23255b2f5da14107a121a727d2d52 /keystone/policy
parent2a8d3e0acb824f06217f23fb3cc246630a5d26c0 (diff)
downloadkeystone-15739739419781128a9994eb28c1ab0ac0bf5e87.tar.gz
keystone-15739739419781128a9994eb28c1ab0ac0bf5e87.tar.xz
keystone-15739739419781128a9994eb28c1ab0ac0bf5e87.zip
Relational API links
- Adds a self-relational link to both individual API entities and collections. - Adds null previous/next links to collections to support pagination in the future. - Temporarily disables pagination (fixes bug 1079661), as the client doesn't currently support or expect it. We probably need to return all results by default unless the client requests a limited resultset anyway. - Expands test coverage for granting roles to users & groups in projects & domains. Change-Id: Ib5d6d39f5e1eb673c3285ef0b98603c5d375de75
Diffstat (limited to 'keystone/policy')
-rw-r--r--keystone/policy/controllers.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/keystone/policy/controllers.py b/keystone/policy/controllers.py
index e3b96252..ee2e4ee3 100644
--- a/keystone/policy/controllers.py
+++ b/keystone/policy/controllers.py
@@ -18,6 +18,9 @@ from keystone.common import controller
class PolicyV3(controller.V3Controller):
+ collection_name = 'policies'
+ member_name = 'policy'
+
@controller.protected
def create_policy(self, context, policy):
ref = self._assign_unique_id(self._normalize_dict(policy))
@@ -25,23 +28,23 @@ class PolicyV3(controller.V3Controller):
self._require_attribute(ref, 'type')
ref = self.policy_api.create_policy(context, ref['id'], ref)
- return {'policy': ref}
+ return PolicyV3.wrap_member(context, ref)
@controller.protected
def list_policies(self, context):
refs = self.policy_api.list_policies(context)
refs = self._filter_by_attribute(context, refs, 'type')
- return {'policies': self._paginate(context, refs)}
+ return PolicyV3.wrap_collection(context, refs)
@controller.protected
def get_policy(self, context, policy_id):
ref = self.policy_api.get_policy(context, policy_id)
- return {'policy': ref}
+ return PolicyV3.wrap_member(context, ref)
@controller.protected
def update_policy(self, context, policy_id, policy):
ref = self.policy_api.update_policy(context, policy_id, policy)
- return {'policy': ref}
+ return PolicyV3.wrap_member(context, ref)
@controller.protected
def delete_policy(self, context, policy_id):