source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/attribute.py @ 6792

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/attribute.py@6797
Revision 6792, 2.4 KB checked in by pjkersha, 10 years ago (diff)

Made ndg.xacml.core.expression.Expression abstract: derived classes must implement the evaluate method used to evaluate a result in a rule condition.

Line 
1"""NDG XACML Attribute type
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "24/03/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: $"
12from ndg.xacml.utils import TypedList
13from ndg.xacml.core import XacmlCoreBase
14from ndg.xacml.core.attributevalue import AttributeValue
15
16
17class Attribute(XacmlCoreBase):
18    """XACML Attribute type"""
19    ELEMENT_LOCAL_NAME = 'Attribute'
20    ATTRIBUTE_VALUE_ELEMENT_LOCAL_NAME = 'AttributeValue'
21    DATA_TYPE_ATTRIB_NAME = 'DataType'
22    ATTRIBUTE_ID_ATTRIB_NAME = 'AttributeId'
23    ISSUER_ATTRIB_NAME = 'Issuer'
24   
25    __slots__ = ('__attributeValues', '__dataType', '__attributeId', '__issuer')
26   
27    def __init__(self):
28        self.__attributeValues = TypedList(AttributeValue)
29        self.__dataType = None
30        self.__attributeId = None
31        self.__issuer = None
32
33    @property
34    def attributeValues(self):
35        "attribute values"
36        return self.__attributeValues
37           
38    def _get_dataType(self):
39        return self.__dataType
40
41    def _set_dataType(self, value):
42        if not isinstance(value, basestring):
43            raise TypeError('Expecting %r type for "dataType" '
44                            'attribute; got %r' % (basestring, type(value)))
45           
46        self.__dataType = value   
47
48    dataType = property(_get_dataType, _set_dataType, None, 
49                        "Attribute data type") 
50       
51    @property
52    def attributeId(self):
53        """Get Attribute Id"""
54        return self.__attributeId
55
56    @attributeId.setter
57    def attributeId(self, value):
58        """Set Attribute Id"""
59        if not isinstance(value, basestring):
60            raise TypeError('Expecting %r type for "attributeId" '
61                            'attribute; got %r' % (basestring, type(value)))
62           
63        self.__attributeId = value 
64       
65    @property
66    def issuer(self):
67        """Get Issuer"""
68        return self.__issuer
69
70    @issuer.setter
71    def issuer(self, value):
72        """Set Issuer"""
73        if not isinstance(value, basestring):
74            raise TypeError('Expecting %r type for "issuer" '
75                            'attribute; got %r' % (basestring, type(value)))
76           
77        self.__issuer = value
Note: See TracBrowser for help on using the repository browser.