summaryrefslogtreecommitdiffstats
path: root/tests/var
diff options
context:
space:
mode:
authorFlaper Fesp <flaper87@gmail.com>2013-04-29 16:58:23 +0200
committerFlaper Fesp <flaper87@gmail.com>2013-05-21 17:18:59 +0200
commit1091b4f3bed9b0ad8c23e5db6d4a5cee15fc786c (patch)
treefe47d22af56baf2919a41c09930ffbf9ec75d63a /tests/var
parent3e0114f570d97c47b1b8eefce0bcd27146098b8d (diff)
downloadoslo-1091b4f3bed9b0ad8c23e5db6d4a5cee15fc786c.tar.gz
oslo-1091b4f3bed9b0ad8c23e5db6d4a5cee15fc786c.tar.xz
oslo-1091b4f3bed9b0ad8c23e5db6d4a5cee15fc786c.zip
Reduce duplicated code related to policies
This patch adds some logic that is currently duplicated throughout Openstack. As part of this de-duplication, the patch also modifies current implementation. Major Changes: * check, set_rules, reset, init are now part of the Enforcer class * check was renamed into enforce * init was renamed into load_rules * It is now possible to load multiple files and have per instance rules instead of global rules. * There's a global instance of the Enforcer class that can be used as main enforcer. from openstack.common import policy ENFORCER = policy.ENFORCER ENFORCER.enforce(rule, target, creds) Minor Changes: * Added do_raise to the enforce method * Enforcer instance is now passed to the Check call. NOTE: If / once this patch gets in, I'll update other projects and port them to the latest version. Change-Id: Ife909bdf3277ef33c2fb1eae16ae261fa6374c63
Diffstat (limited to 'tests/var')
-rw-r--r--tests/var/policy.json4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/var/policy.json b/tests/var/policy.json
new file mode 100644
index 0000000..73730ae
--- /dev/null
+++ b/tests/var/policy.json
@@ -0,0 +1,4 @@
+{
+ "default": "rule:admin",
+ "admin": "is_admin:True"
+}