Remove unused functions from policy enforcer

The policy.Enforcer class has two functions which we don't use
anywhere, and the check function is broken due to an argument
mismatch with _check, so remove them until such time as they
are actually needed.

Change-Id: I25199fffeed5905b0673f137c70720ddb6dc48cb
This commit is contained in:
Steven Hardy 2014-07-16 17:10:59 +01:00
parent e8e44ad11f
commit 4818a37a27
2 changed files with 0 additions and 21 deletions

View File

@ -76,16 +76,6 @@ class Enforcer(object):
_target = target or {} _target = target or {}
return self._check(context, _action, _target, self.exc, action=action) return self._check(context, _action, _target, self.exc, action=action)
def check(self, context, action, target):
"""Verifies that the action is valid on the target in this context.
:param context: Heat request context
:param action: String representing the action to be checked
:param target: Dictionary representing the object of the action.
:returns: A non-False value if access is allowed.
"""
return self._check(context, action, target)
def check_is_admin(self, context): def check_is_admin(self, context):
"""Whether or not roles contains 'admin' role according to policy.json """Whether or not roles contains 'admin' role according to policy.json
@ -93,6 +83,3 @@ class Enforcer(object):
:returns: A non-False value if the user is admin according to policy :returns: A non-False value if the user is admin according to policy
""" """
return self._check(context, 'context_is_admin', target={}, exc=None) return self._check(context, 'context_is_admin', target={}, exc=None)
def clear(self):
self.enforcer.clear()

View File

@ -124,14 +124,6 @@ class TestPolicyEnforcer(HeatTestCase):
# Everything should be allowed # Everything should be allowed
enforcer.enforce(ctx, action) enforcer.enforce(ctx, action)
def test_clear(self):
self.stub_policyfile('deny_stack_user.json')
enforcer = policy.Enforcer()
enforcer.load_rules(force_reload=True)
enforcer.clear()
self.assertEqual({}, enforcer.enforcer.rules)
def test_set_rules_overwrite_true(self): def test_set_rules_overwrite_true(self):
self.stub_policyfile('deny_stack_user.json') self.stub_policyfile('deny_stack_user.json')