Ignore:
Timestamp:
20/08/10 15:46:35 (10 years ago)
Author:
pjkersha
Message:

Incomplete - task 2: XACML-Security Integration

  • important fix to ndg.xacml.core.rule.Rule.evaluate: return NotApplicable? where Target matches but Condition does not match
  • optimised ndg.xacml.core.functions.v1.at_least_one_member_of.AtLeastOneMemberOfBase? to use set and '&' operator for this function.
  • fix to ndg.xacml.core.functions.FunctionMap?.loadFunction to catch function namespace not recognised.
File:
1 edited

Legend:

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

    r7109 r7351  
    278278    ) 
    279279 
    280  
     280from ndg.xacml import XacmlError 
     281 
     282 
     283class UnsupportedFunctionError(XacmlError): 
     284    """Encountered a function type that is not recognised as part of the XACML 
     285    specification and is not supported in this implementation""" 
     286 
     287  
     288class UnsupportedStdFunctionError(UnsupportedFunctionError):  
     289    """Encountered a function type that is not supported even though it is 
     290    part of the XACML specification""" 
     291     
     292     
     293def unsupportedFunctionErrorFactory(identifier, msg=None): 
     294    """Factory function to return an unsupported function exception based on 
     295    the function identifier passed in 
     296     
     297    @param identifier: XACML function namespace to check 
     298    @type identifier: basestring 
     299     
     300    @return: unsupported function exception instance 
     301    @rtype: UnsupportedFunctionError or UnsupportedStdFunctionError depending 
     302    on the identifier passed 
     303    """ 
     304    if identifier in XacmlFunctionNames.FUNCTION_NAMES: 
     305        if msg is None: 
     306            msg = "%s: %s" % (UnsupportedStdFunctionError.__doc__, identifier) 
     307             
     308        raise UnsupportedStdFunctionError(msg) 
     309    else: 
     310        if msg is None: 
     311            msg = "%s: %s" % (UnsupportedFunctionError.__doc__, identifier) 
     312             
     313        raise UnsupportedFunctionError(msg) 
     314     
     315     
    281316class FunctionClassFactoryInterface(object): 
    282317    """Interface class for function module class factory class 
     
    443478             
    444479    def __call__(self, identifier): 
    445         """Return the class for the given XACML *-at-least-one-member-of type 
    446         function identifier 
     480        """Return the class for the given XACML type function identifier 
     481         
    447482        @param identifier: XACML *-at-least-one-member-of type function 
    448483        identifier 
     
    622657            self[functionNs] = NotImplemented 
    623658        else: 
    624             self[functionNs] = functionFactory(functionNs) 
     659            function = functionFactory(functionNs) 
     660            if function is None: 
     661                raise unsupportedFunctionErrorFactory(functionNs) 
     662                 
     663            self[functionNs] = function 
    625664            self.__classFactoryMap[functionNs] = functionFactory 
    626665                        
Note: See TracChangeset for help on using the changeset viewer.