summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorguohliu <guohliu@cn.ibm.com>2013-06-25 16:56:22 +0800
committerguohliu <guohliu@cn.ibm.com>2013-07-12 15:55:16 +0800
commite4ac367561b3811a9cd94e51accdf8045b7d6adc (patch)
treeb401a14cf458d529c447f064a244639dba039d6d /openstack
parentba32f8ecb33403885ea521e3c2dcc4b49a81bd71 (diff)
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
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/policy.py14
1 files changed, 7 insertions, 7 deletions
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.