Package ndg :: Package xacml :: Package finder :: Module localpolicyfinder
[hide private]

Source Code for Module ndg.xacml.finder.localpolicyfinder

 1  """NDG XACML policy finder resolving within base policy document 
 2   
 3  NERC DataGrid 
 4  """ 
 5  __author__ = "R B Wilkinson" 
 6  __date__ = "02/11/11" 
 7  __copyright__ = "(C) 2011 Science and Technology Facilities Council" 
 8  __contact__ = "Philip.Kershaw@stfc.ac.uk" 
 9  __license__ = "BSD - see LICENSE file in top-level directory" 
10  __contact__ = "Philip.Kershaw@stfc.ac.uk" 
11  __revision__ = "$Id$" 
12  from ndg.xacml.finder.policyfinderbase import PolicyFinderBase 
13  from ndg.xacml.parsers import XMLParseError 
14   
15 -class LocalPolicyFinder(PolicyFinderBase):
16 """ 17 Policy and Policy Set finder that only resolves references to already parsed 18 Polices and Policy Sets. 19 """
20 - def findPolicy(self, policyIdReference, common):
21 """ 22 Retrieves a policy for a specified policy ID. 23 @param policyIdReference: policy ID reference 24 @type policyIdReference: str 25 @param common: parsing common data 26 @type common: from ndg.xacml.parsers.common.Common 27 @return: policy 28 @rtype: ndg.xacml.core.policy.Policy 29 @raise XMLParseError: policy of specified ID not found 30 """ 31 if policyIdReference not in self.policyMap: 32 raise XMLParseError("Referenced Policy of ID %r not found" % policyIdReference) 33 return self.policyMap.get(policyIdReference, None)
34
35 - def findPolicySet(self, policySetIdReference, common):
36 """ 37 Retrieves a policy set for a specified policy set ID. 38 @param policySetIdReference: policy set ID reference 39 @type policySetIdReference: str 40 @param common: parsing common data 41 @type common: from ndg.xacml.parsers.common.Common 42 @return: policy set 43 @rtype: ndg.xacml.core.policy.PolicySet 44 @raise XMLParseError: policy set of specified ID not found 45 """ 46 if policySetIdReference not in self.policySetMap: 47 raise XMLParseError("Referenced PolicySet of ID %r not found" % policySetIdReference) 48 return self.policySetMap.get(policySetIdReference, None)
49