Modify api and remove project_id

Change-Id: If87115db29f6f1bf80963be2b3af5d6d8a5f1caf
This commit is contained in:
lvdongbing 2016-05-11 21:32:49 -04:00
parent 2c9d918525
commit d1f574f9dc
4 changed files with 10 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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