source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributeselector.py @ 6754

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

Parsing complete for all XACML example rules but minus Obligations implementation. This is probably not needed for NDG. Added original NDG test policy to test parsing with this.

Line 
1"""NDG XACML AttributeSelector type
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "16/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: $"
12import logging
13log = logging.getLogger(__name__)
14
15from ndg.xacml.core.expression import Expression
16
17
18class AttributeSelector(Expression):
19    '''XACML Attribute Selector type
20    '''
21    ELEMENT_LOCAL_NAME = 'AttributeSelector'
22    MUST_BE_PRESENT_ATTRIB_NAME = 'MustBePresent'
23    REQUEST_CONTEXT_PATH_ATTRIB_NAME = 'RequestContextPath'
24   
25    __slots__ = ('__mustBePresent', '__requestContextPath')
26
27    def __init__(self):
28        '''XACML Attribute Selector type
29        '''
30        super(AttributeSelector, self).__init__()
31        self.__mustBePresent = None
32        self.__requestContextPath = None
33       
34    @property
35    def requestContextPath(self):
36        """Get Issuer"""
37        return self.__requestContextPath
38
39    @requestContextPath.setter
40    def requestContextPath(self, value):
41        """Set Issuer"""
42        if not isinstance(value, basestring):
43            raise TypeError('Expecting %r type for "requestContextPath" '
44                            'attribute; got %r' % (basestring, type(value)))
45           
46        self.__requestContextPath = value   
47
48    @property
49    def mustBePresent(self):
50        """Get Must Be Present flag"""
51        return self.__mustBePresent
52
53    @mustBePresent.setter
54    def mustBePresent(self, value):
55        """Set Must Be Present flag"""
56        if not isinstance(value, bool):
57            raise TypeError('Expecting %r type for "mustBePresent" '
58                            'attribute; got %r' % (bool, type(value)))
59           
60        self.__mustBePresent = value       
Note: See TracBrowser for help on using the repository browser.