From e4ac367561b3811a9cd94e51accdf8045b7d6adc Mon Sep 17 00:00:00 2001 From: guohliu Date: Tue, 25 Jun 2013 16:56:22 +0800 Subject: Fix missing argument bug in oslo common policy Some checks in policy module missing a argument, this patch fixed it by adding the necessary argument. Fixed bug #1194354 Change-Id: I41338675842be517146062d11012462c5c90d6e5 --- openstack/common/policy.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'openstack') diff --git a/openstack/common/policy.py b/openstack/common/policy.py index 40e5a6e..1062147 100644 --- a/openstack/common/policy.py +++ b/openstack/common/policy.py @@ -285,7 +285,7 @@ class BaseCheck(object): pass @abc.abstractmethod - def __call__(self, target, cred): + def __call__(self, target, cred, enforcer): """Triggers if instance of the class is called. Performs the check. Returns False to reject the access or a @@ -303,7 +303,7 @@ class FalseCheck(BaseCheck): return "!" - def __call__(self, target, cred): + def __call__(self, target, cred, enforcer): """Check the policy.""" return False @@ -317,7 +317,7 @@ class TrueCheck(BaseCheck): return "@" - def __call__(self, target, cred): + def __call__(self, target, cred, enforcer): """Check the policy.""" return True @@ -363,13 +363,13 @@ class NotCheck(BaseCheck): return "not %s" % self.rule - def __call__(self, target, cred): + def __call__(self, target, cred, enforcer): """Check the policy. Returns the logical inverse of the wrapped check. """ - return not self.rule(target, cred) + return not self.rule(target, cred, enforcer) class AndCheck(BaseCheck): @@ -391,7 +391,7 @@ class AndCheck(BaseCheck): return "(%s)" % ' and '.join(str(r) for r in self.rules) - def __call__(self, target, cred): + def __call__(self, target, cred, enforcer): """Check the policy. Requires that all rules accept in order to return True. @@ -434,7 +434,7 @@ class OrCheck(BaseCheck): return "(%s)" % ' or '.join(str(r) for r in self.rules) - def __call__(self, target, cred): + def __call__(self, target, cred, enforcer): """Check the policy. Requires that at least one rule accept in order to return True. -- cgit