Ignore:
Timestamp:
25/06/10 13:14:03 (10 years ago)
Author:
pjkersha
Message:

Incomplete - task 2: XACML-Security Integration

  • updating epydoc ready for release.
File:
1 edited

Legend:

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

    r7087 r7088  
    2323 
    2424class AbstractFunction(object): 
    25     """Base class for all XACML matching functions""" 
    26      
     25    """Abstract Base class for all XACML matching functions 
     26    @cvar FUNCTION_NS: namespace for the given function 
     27    @type FUNCTION_NS: NoneType (must be string in derived type) 
     28     
     29    @cvar V1_0_FUNCTION_NS: XACML 1.0 function namespace prefix 
     30    @type V1_0_FUNCTION_NS: string 
     31     
     32    @cvar V2_0_FUNCTION_NS: XACML 2.0 function namespace prefix 
     33    @type V2_0_FUNCTION_NS: string 
     34    """ 
    2735    __metaclass__ = ABCMeta 
     36     
    2837    FUNCTION_NS = None 
    2938    V1_0_FUNCTION_NS = "urn:oasis:names:tc:xacml:1.0:function:" 
     
    3140     
    3241    def __init__(self): 
     42        """ 
     43        @raise TypeError: if FUNCTION_NS not set correctly 
     44        """ 
    3345        if self.__class__.FUNCTION_NS is None: 
    3446            raise TypeError('"FUNCTION_NS" class variable must be defined in ' 
     
    3850    def evaluate(self, *inputs): 
    3951        """Evaluate the function from the given input arguments and context 
     52         
    4053        @param inputs: input arguments need to evaluate the function 
    4154        @type inputs: tuple 
    42         @return: True for match, False otherwise 
    43         @rtype: bool 
     55        @return: derived type should return True for match, False otherwise 
     56        @rtype: bool (derived type), NoneType for THIS implementation 
    4457        """ 
    4558         
    4659class XacmlFunctionNames(object): 
    47     """XACML standard match function names""" 
     60    """XACML standard match function names 
     61     
     62    @cvar FUNCTION_NAMES: list of all the XACML function URNs 
     63    @type FUNCTION_NAMES: tuple     
     64    """ 
    4865    FUNCTION_NAMES = ( 
    4966'urn:oasis:names:tc:xacml:1.0:function:string-equal', 
     
    275292        @return: at least one member of class corresponding to the given input 
    276293        identifier 
    277         @rtype: AbstractFunction derived type or None if no match is  
    278         found 
     294        @rtype: AbstractFunction derived type or NoneType if no match is found 
    279295        ''' 
    280296        return None 
     
    462478    FunctionClassFactoryInterface implementations so that a function class can  
    463479    be obtained directly from a given XACML function URN.   
     480     
     481    @cvar FUNCTION_PKG_PREFIX: python package path for functions package 
     482    @type FUNCTION_PKG_PREFIX: string 
     483     
     484    @cvar V1_0_PKG_PREFIX: python package path for XACML 1.0 functions package 
     485    @type V1_0_PKG_PREFIX: string 
     486     
     487    @cvar V2_0_PKG_PREFIX: python package path for XACML 2.0 functions package 
     488    @type V2_0_PKG_PREFIX: string 
     489     
     490    @cvar SUPPORTED_NSS: mapping of function URN prefix to Python package 
     491    @type SUPPORTED_NSS: dict 
     492     
     493    @cvar FUNCTION_CLASS_FACTORY_CLASSNAME: standard name for class factory 
     494    which should be present in each generic function module.  This factory is  
     495    invoked to create the function class for any given function URN related to 
     496    that module 
     497    @type FUNCTION_CLASS_FACTORY_CLASSNAME: string 
    464498    """ 
    465499    FUNCTION_PKG_PREFIX = 'ndg.xacml.core.functions.' 
     
    496530    @staticmethod 
    497531    def keyFilter(key): 
    498         """Enforce string type keys""" 
     532        """Enforce string type keys 
     533         
     534        @param key: function URN 
     535        @type key: basestring 
     536        @return: True for valid key type 
     537        @rtype: bool 
     538        @raise TypeError: invalid key type 
     539        """ 
    499540        if not isinstance(key, basestring): 
    500541            raise TypeError('Expecting %r type for key; got %r' %  
     
    505546    @staticmethod 
    506547    def valueFilter(value): 
    507         """Enforce AbstractFunction derived types for match functions""" 
     548        """Enforce AbstractFunction derived types for match functions 
     549         
     550        @param value: function URN 
     551        @type value: ndg.xacml.core.functions.AbstractFunction / NotImplemented 
     552        @return: True for valid function type 
     553        @rtype: bool 
     554        @raise TypeError: invlaid key type 
     555        """ 
    508556        if value is NotImplemented: 
    509557            return True 
     
    580628        """Override base class implementation to load and cache function classes 
    581629        if they don't otherwise exist 
     630         
     631        @param key: function URN 
     632        @type key: basestring 
     633        @return: function class 
     634        @rtype: ndg.xacml.core.functions.AbstractFunction / NotImplemented 
    582635        """ 
    583636        functionClass = VettedDict.get(self, key) 
     
    590643        """Likewise to __getitem__, enable loading and caching of function  
    591644        classes if they don't otherwise exist 
     645         
     646        @param key: XACML function URN 
     647        @type key: basestring 
     648        @param *arg: set a single additional argument if required which is  
     649        used as the default value should the key not be found in the map 
     650        @type *arg: tuple 
     651        @return: function class 
     652        @rtype: ndg.xacml.core.functions.AbstractFunction / NotImplemented 
    592653        """ 
    593654        functionClass = VettedDict.get(self, key, *arg) 
Note: See TracChangeset for help on using the changeset viewer.