diff options
author | Dolph Mathews <dolph.mathews@gmail.com> | 2012-12-05 09:58:54 -0600 |
---|---|---|
committer | Dolph Mathews <dolph.mathews@gmail.com> | 2012-12-05 10:32:47 -0600 |
commit | c858c1b304cae6310f08a220cf54c763f684fc42 (patch) | |
tree | 0b5dcfbed4c30bc7f40a3e9899af244c27a27a4c /keystone/policy | |
parent | 75277cf1ae496145369e929702005ef2304e6942 (diff) | |
download | keystone-c858c1b304cae6310f08a220cf54c763f684fc42.tar.gz keystone-c858c1b304cae6310f08a220cf54c763f684fc42.tar.xz keystone-c858c1b304cae6310f08a220cf54c763f684fc42.zip |
Only 'import *' from 'core' modules
- Renamed identity.controllers.* and identity.routers.* since they
now occopy unique namespaces (thanks ayoung!)
- Moved catalog and policy controllers into their own respective modules
Change-Id: Ib9e277355e0eac15d4d218785c816b718b493b5b
Diffstat (limited to 'keystone/policy')
-rw-r--r-- | keystone/policy/__init__.py | 1 | ||||
-rw-r--r-- | keystone/policy/controllers.py | 48 | ||||
-rw-r--r-- | keystone/policy/core.py | 32 |
3 files changed, 49 insertions, 32 deletions
diff --git a/keystone/policy/__init__.py b/keystone/policy/__init__.py index 8a355c11..3379c617 100644 --- a/keystone/policy/__init__.py +++ b/keystone/policy/__init__.py @@ -15,3 +15,4 @@ # under the License. from keystone.policy.core import * +from keystone.policy import controllers diff --git a/keystone/policy/controllers.py b/keystone/policy/controllers.py new file mode 100644 index 00000000..e3b96252 --- /dev/null +++ b/keystone/policy/controllers.py @@ -0,0 +1,48 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 OpenStack LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from keystone.common import controller + + +class PolicyV3(controller.V3Controller): + @controller.protected + def create_policy(self, context, policy): + ref = self._assign_unique_id(self._normalize_dict(policy)) + self._require_attribute(ref, 'blob') + self._require_attribute(ref, 'type') + + ref = self.policy_api.create_policy(context, ref['id'], ref) + return {'policy': 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)} + + @controller.protected + def get_policy(self, context, policy_id): + ref = self.policy_api.get_policy(context, policy_id) + return {'policy': ref} + + @controller.protected + def update_policy(self, context, policy_id, policy): + ref = self.policy_api.update_policy(context, policy_id, policy) + return {'policy': ref} + + @controller.protected + def delete_policy(self, context, policy_id): + return self.policy_api.delete_policy(context, policy_id) diff --git a/keystone/policy/core.py b/keystone/policy/core.py index 2e5676fc..447e11e3 100644 --- a/keystone/policy/core.py +++ b/keystone/policy/core.py @@ -18,7 +18,6 @@ from keystone.common import manager -from keystone.common import controller from keystone import config from keystone import exception @@ -102,34 +101,3 @@ class Driver(object): """ raise exception.NotImplemented() - - -class PolicyControllerV3(controller.V3Controller): - @controller.protected - def create_policy(self, context, policy): - ref = self._assign_unique_id(self._normalize_dict(policy)) - self._require_attribute(ref, 'blob') - self._require_attribute(ref, 'type') - - ref = self.policy_api.create_policy(context, ref['id'], ref) - return {'policy': 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)} - - @controller.protected - def get_policy(self, context, policy_id): - ref = self.policy_api.get_policy(context, policy_id) - return {'policy': ref} - - @controller.protected - def update_policy(self, context, policy_id, policy): - ref = self.policy_api.update_policy(context, policy_id, policy) - return {'policy': ref} - - @controller.protected - def delete_policy(self, context, policy_id): - return self.policy_api.delete_policy(context, policy_id) |