Changeset 7668


Ignore:
Timestamp:
28/10/10 16:39:24 (9 years ago)
Author:
pjkersha
Message:

Modified apply and match classes to use a FunctionMap? class singleton to enable easy addition of new function types.

Location:
TI12-security/trunk/ndg_xacml/ndg/xacml
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/apply.py

    r7365 r7668  
    1212from ndg.xacml.utils import TypedList 
    1313from ndg.xacml.core.expression import Expression 
    14 from ndg.xacml.core.functions import (FunctionMap, UnsupportedStdFunctionError, 
     14from ndg.xacml.core.functions import (FunctionMap, functionMap, 
     15                                      UnsupportedStdFunctionError, 
    1516                                      UnsupportedFunctionError) 
    1617 
     
    5354        self.__functionId = None 
    5455        self.__function = None 
    55         self.__functionMap = FunctionMap() 
     56        self.__functionMap = functionMap 
    5657        self.__loadFunctionFromId = True 
    5758        self.__expressions = TypedList(Expression) 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/functions/__init__.py

    r7351 r7668  
    598598        return True  
    599599            
    600     def loadAll(self): 
    601         """Load function map with implementations from the relevant function 
    602         package""" 
     600    def loadAllCore(self): 
     601        """Load all core XACML functions""" 
    603602         
    604603        for functionNs in XacmlFunctionNames.FUNCTION_NAMES: 
     
    698697            return functionClass 
    699698 
    700  
    701          
     699# Function map singleton used by match and apply classes - add new keys to 
     700# this dictionary to enable support for custom functions 
     701functionMap = FunctionMap() 
     702         
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/match.py

    r7351 r7668  
    1717from ndg.xacml.core.attributedesignator import AttributeDesignator 
    1818from ndg.xacml.core.attributeselector import AttributeSelector 
    19 from ndg.xacml.core.functions import (FunctionMap, UnsupportedStdFunctionError, 
     19from ndg.xacml.core.functions import (FunctionMap, functionMap, 
     20                                      UnsupportedStdFunctionError, 
    2021                                      UnsupportedFunctionError) 
    2122from ndg.xacml.core.context.exceptions import XacmlContextError 
     
    8283         
    8384        self.__function = None 
    84         self.__functionMap = FunctionMap() 
     85        self.__functionMap = functionMap 
    8586        self.__loadFunctionFromId = True 
    8687         
  • TI12-security/trunk/ndg_xacml/ndg/xacml/test/context/test_pdp_with_custom_attributevalue_types.py

    r7666 r7668  
    1919from ndg.xacml.core.attribute import Attribute 
    2020from ndg.xacml.core.attributevalue import AttributeValueClassFactory 
    21  
     21from ndg.xacml.core.functions import functionMap 
     22from ndg.xacml.core.functions.v1.bag import BagBase 
     23from ndg.xacml.core.functions.v1.at_least_one_member_of import \ 
     24    AtLeastOneMemberOfBase  
    2225from ndg.xacml.core.context.request import Request 
    2326from ndg.xacml.core.context.subject import Subject 
    2427from ndg.xacml.core.context.resource import Resource 
    2528from ndg.xacml.core.context.action import Action 
     29 
    2630from ndg.xacml.parsers.etree.factory import ReaderFactory 
    2731from ndg.xacml.parsers.etree.attributevaluereader import ( 
     
    116120                                ETreeGroupRoleDataTypeReader) 
    117121         
     122        # Add extra matching and bag functions 
     123         
    118124        # Example policy with custom attribute value type used with ESGF  
    119125        self.pdp = PDP.fromPolicySource(XACML_ESGFTEST1_FILEPATH, ReaderFactory) 
  • TI12-security/trunk/ndg_xacml/ndg/xacml/test/test_functions.py

    r7667 r7668  
    2828    def test01LoadMap(self):    
    2929        funcMap = FunctionMap() 
    30         funcMap.loadAll() 
     30        funcMap.loadAllCore() 
    3131        anyUriMatchNs = \ 
    3232            'urn:oasis:names:tc:xacml:2.0:function:anyURI-regexp-match' 
Note: See TracChangeset for help on using the changeset viewer.