source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributedesignator.py @ 6750

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributedesignator.py@6750
Revision 6750, 2.0 KB checked in by pjkersha, 9 years ago (diff)

Parsing functionality near complete for rule1.xml

Line 
1'''
2Created on 16 Mar 2010
3
4@author: pjkersha
5'''
6from ndg.xacml.core.expression import Expression
7
8
9class AttributeDesignator(Expression):
10    '''XACML Attribute Designator type
11    '''
12    ATTRIBUTE_ID_ATTRIB_NAME = 'AttributeId'
13    ISSUER_ATTRIB_NAME = 'Issuer'
14    MUST_BE_PRESENT_ATTRIB_NAME = 'MustBePresent'
15   
16    __slots__ = ('__attributeId', '__issuer', '__mustBePresent')
17   
18    def __init__(self):
19        super(AttributeDesignator, self).__init__()
20        self.__attributeId = None
21        self.__issuer = None
22        self.__mustBePresent = False
23
24    @property
25    def attributeId(self):
26        """Get Attribute Id"""
27        return self.__attributeId
28
29    @attributeId.setter
30    def attributeId(self, value):
31        """Set Attribute Id"""
32        if not isinstance(value, basestring):
33            raise TypeError('Expecting %r type for "attributeId" '
34                            'attribute; got %r' % (basestring, type(value)))
35           
36        self.__attributeId = value 
37       
38    @property
39    def issuer(self):
40        """Get Issuer"""
41        return self.__issuer
42
43    @issuer.setter
44    def issuer(self, value):
45        """Set Issuer"""
46        if not isinstance(value, basestring):
47            raise TypeError('Expecting %r type for "issuer" '
48                            'attribute; got %r' % (basestring, type(value)))
49           
50        self.__issuer = value   
51
52    @property
53    def mustBePresent(self):
54        """Get Must Be Present flag"""
55        return self.__mustBePresent
56
57    @mustBePresent.setter
58    def mustBePresent(self, value):
59        """Set Must Be Present flag"""
60        if not isinstance(value, bool):
61            raise TypeError('Expecting %r type for "mustBePresent" '
62                            'attribute; got %r' % (bool, type(value)))
63           
64        self.__mustBePresent = value       
65       
66       
67class SubjectAttributeDesignator(AttributeDesignator):
68    """XACML Subject Attribute Designator type"""
69    ELEMENT_LOCAL_NAME = 'SubjectAttributeDesignator'
Note: See TracBrowser for help on using the repository browser.