diff options
author | termie <github@anarkystic.com> | 2012-01-18 20:06:27 -0800 |
---|---|---|
committer | termie <github@anarkystic.com> | 2012-01-18 20:06:27 -0800 |
commit | 909012a63e5761b4ff09d2c63a7a0493f7daffa6 (patch) | |
tree | 5fd6480d77f3fa3c8d1aac1e4536910821d33c2e /keystone/policy | |
parent | f0e3e7f123c24f4441de14be34e5b9fd307354aa (diff) | |
download | keystone-909012a63e5761b4ff09d2c63a7a0493f7daffa6.tar.gz keystone-909012a63e5761b4ff09d2c63a7a0493f7daffa6.tar.xz keystone-909012a63e5761b4ff09d2c63a7a0493f7daffa6.zip |
establish basic structure
Diffstat (limited to 'keystone/policy')
-rw-r--r-- | keystone/policy/__init__.py | 0 | ||||
-rw-r--r-- | keystone/policy/backends/__init__.py | 0 | ||||
-rw-r--r-- | keystone/policy/backends/simple.py | 21 | ||||
-rw-r--r-- | keystone/policy/core.py | 24 |
4 files changed, 45 insertions, 0 deletions
diff --git a/keystone/policy/__init__.py b/keystone/policy/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/keystone/policy/__init__.py diff --git a/keystone/policy/backends/__init__.py b/keystone/policy/backends/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/keystone/policy/backends/__init__.py diff --git a/keystone/policy/backends/simple.py b/keystone/policy/backends/simple.py new file mode 100644 index 00000000..643d3e21 --- /dev/null +++ b/keystone/policy/backends/simple.py @@ -0,0 +1,21 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + + +import logging + + +class TrivialTrue(object): + def can_haz(self, target, credentials): + return True + + +class SimpleMatch(object): + def can_haz(self, target, credentials): + """Check whether key-values in target are present in credentials.""" + # TODO(termie): handle ANDs, probably by providing a tuple instead of a + # string + for requirement in target: + key, match = requirement.split(':', 1) + check = credentials.get(key) + if check == match: + return True diff --git a/keystone/policy/core.py b/keystone/policy/core.py new file mode 100644 index 00000000..4aa24df7 --- /dev/null +++ b/keystone/policy/core.py @@ -0,0 +1,24 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +"""Main entry point into the Policy service.""" + +from keystone import config +from keystone import manager + + +CONF = config.CONF + + +class Manager(manager.Manager): + """Default pivot point for the Policy backend. + + See :mod:`keystone.manager.Manager` for more details on how this + dynamically calls the backend. + + See :mod:`keystone.backends.base.Policy` for more details on the + interface provided by backends. + + """ + + def __init__(self): + super(Manager, self).__init__(CONF.policy.driver) |