congress/congress/tests/fake_policy.py
Aaron Rosen da4a6c3ac3 Add OpenStack policy integration bits
This patch adds the openstack policy integration bits which we can use to
enforce which congress api calls can be made by a normal tenant
vs admin tenant. Today the default policy.json defaults to requiring an
admin to make an API call. Though, for example, one could add the following
to policy.json to allow a non-admin tenant to create a data-source:

"create_data_sources": "rule:regular_user"

This patch also renames Context to RequestContext and drops some unneeded code.

Related to blueprint keystone-integration

Change-Id: I7fe17938ba6814df3679d9d9fd0ed1cd4fc3771f
2014-08-01 11:43:39 -07:00

24 lines
756 B
Python

# Copyright (c) 2012 OpenStack Foundation
#
# 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.
policy_data = """
{
"context_is_admin": "role:admin",
"admin_only": "rule:context_is_admin",
"regular_user": "",
"default": "rule:admin_only"
}
"""