Ignore:
Timestamp:
16/03/10 11:56:31 (11 years ago)
Author:
pjkersha
Message:

Added XACML Target ElementTree based parser.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/policy.py

    r6731 r6734  
    1 ''' 
    2 Created on 24 Feb 2010 
    3  
    4 @author: pjkersha 
    5 ''' 
     1"""NDG Security Policy type definition 
     2 
     3NERC DataGrid Project 
     4""" 
     5__author__ = "P J Kershaw" 
     6__date__ = "24/02/10" 
     7__copyright__ = "(C) 2010 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: $" 
    612from ndg.security.common.utils import TypedList 
    713from ndg.security.common.authz.xacml import PolicyComponent 
     14from ndg.security.common.authz.xacml.target import Target 
    815from ndg.security.common.authz.xacml.rule import Rule 
    916from ndg.security.common.authz.xacml.obligation import Obligation 
     
    147154        return self.__obligations  
    148155 
    149     def _getTargets(self): 
    150         return self.__targets 
    151  
    152     def _setTargets(self, value): 
    153         if (not isinstance(value, TypedList) and  
    154             not issubclass(value.elementType, Target.__class__)): 
    155             raise TypeError('Expecting TypedList(Target) for "targets" ' 
    156                             'attribute; got %r' % type(value)) 
    157         self.__targets = value 
    158  
    159     targets = property(_getTargets, _setTargets,  
    160                        doc="list of Policy targets") 
     156    def _getTarget(self): 
     157        return self.__target 
     158 
     159    def _setTarget(self, value): 
     160        if not isinstance(value, Target): 
     161            raise TypeError('Expecting Target for "target" ' 
     162                            'attribute; got %r' % type(value)) 
     163        self.__target = value 
     164 
     165    target = property(_getTarget, _setTarget, doc="list of Policy targets") 
    161166 
    162167    def _getDescription(self): 
Note: See TracChangeset for help on using the changeset viewer.