Merge "Modify api and remove project_id"

This commit is contained in:
Jenkins 2016-05-12 03:16:10 +00:00 committed by Gerrit Code Review
commit 2408d71cb4
4 changed files with 10 additions and 12 deletions

View File

@ -51,6 +51,7 @@ class FaultWrapper(wsgi.Middleware):
'InvalidParameter': webob.exc.HTTPBadRequest, 'InvalidParameter': webob.exc.HTTPBadRequest,
'InvalidSchemaError': webob.exc.HTTPBadRequest, 'InvalidSchemaError': webob.exc.HTTPBadRequest,
'MultipleChoices': webob.exc.HTTPBadRequest, 'MultipleChoices': webob.exc.HTTPBadRequest,
'UserNotFound': webob.exc.HTTPNotFound,
'RuleNotFound': webob.exc.HTTPNotFound, 'RuleNotFound': webob.exc.HTTPNotFound,
'RuleTypeNotFound': webob.exc.HTTPNotFound, 'RuleTypeNotFound': webob.exc.HTTPNotFound,
'RuleTypeNotMatch': webob.exc.HTTPBadRequest, 'RuleTypeNotMatch': webob.exc.HTTPBadRequest,

View File

@ -30,7 +30,7 @@ class API(wsgi.Router):
# Users # Users
users_resource = users.create_resource(conf) users_resource = users.create_resource(conf)
users_path = "/{project_id}/users" users_path = "/users"
with mapper.submapper(controller=users_resource, with mapper.submapper(controller=users_resource,
path_prefix=users_path) as user_mapper: path_prefix=users_path) as user_mapper:
@ -60,7 +60,7 @@ class API(wsgi.Router):
# Resources # Resources
res_resource = resources.create_resource(conf) res_resource = resources.create_resource(conf)
res_path = "/{project_id}/resources" res_path = "/resources"
with mapper.submapper(controller=res_resource, with mapper.submapper(controller=res_resource,
path_prefix=res_path) as res_mapper: path_prefix=res_path) as res_mapper:
@ -84,7 +84,7 @@ class API(wsgi.Router):
# Rules # Rules
rule_resource = rules.create_resource(conf) rule_resource = rules.create_resource(conf)
rule_path = "/{project_id}/rules" rule_path = "/rules"
with mapper.submapper(controller=rule_resource, with mapper.submapper(controller=rule_resource,
path_prefix=rule_path) as rule_mapper: path_prefix=rule_path) as rule_mapper:
@ -120,7 +120,7 @@ class API(wsgi.Router):
# Policies # Policies
policy_resource = policies.create_resource(conf) policy_resource = policies.create_resource(conf)
policy_path = "/{project_id}/policies" policy_path = "/policies"
with mapper.submapper(controller=policy_resource, with mapper.submapper(controller=policy_resource,
path_prefix=policy_path) as policy_mapper: path_prefix=policy_path) as policy_mapper:
@ -162,7 +162,7 @@ class API(wsgi.Router):
# Events # Events
event_resource = events.create_resource(conf) event_resource = events.create_resource(conf)
event_path = "/{project_id}/events" event_path = "/events"
with mapper.submapper(controller=event_resource, with mapper.submapper(controller=event_resource,
path_prefix=event_path) as event_mapper: path_prefix=event_path) as event_mapper:

View File

@ -28,10 +28,7 @@ def policy_enforce(handler):
This is a handler method decorator. This is a handler method decorator.
""" """
@functools.wraps(handler) @functools.wraps(handler)
def handle_bilean_method(controller, req, project_id, **kwargs): def handle_bilean_method(controller, req, **kwargs):
if req.context.project != project_id:
raise exc.HTTPForbidden()
rule = "%s:%s" % (controller.REQUEST_SCOPE, handler.__name__) rule = "%s:%s" % (controller.REQUEST_SCOPE, handler.__name__)
allowed = policy.enforce(context=req.context, allowed = policy.enforce(context=req.context,
rule=rule, target={}) rule=rule, target={})

View File

@ -36,9 +36,9 @@ if [[ -z $SERVICE_ID ]]; then
fi fi
openstack endpoint create \ openstack endpoint create \
--adminurl "http://$HOST:$PORT/v1/\$(project_id)s" \ --adminurl "http://$HOST:$PORT/v1" \
--publicurl "http://$HOST:$PORT/v1/\$(project_id)s" \ --publicurl "http://$HOST:$PORT/v1" \
--internalurl "http://$HOST:$PORT/v1/\$(project_id)s" \ --internalurl "http://$HOST:$PORT/v1" \
--region RegionOne \ --region RegionOne \
bilean bilean