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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributedesignator.py@6790
Revision 6790, 2.8 KB checked in by pjkersha, 10 years ago (diff)
  • Added marshalling function for condition <Apply> to marshall inputs for given functionId.
  • implemented string-at-least-one-member-of function.
Line 
1"""NDG XACML AttributeDesignator 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: $"
12from ndg.xacml.core.expression import Expression
13
14
15class AttributeDesignator(Expression):
16    '''XACML Attribute Designator type
17    '''
18    ATTRIBUTE_ID_ATTRIB_NAME = 'AttributeId'
19    ISSUER_ATTRIB_NAME = 'Issuer'
20    MUST_BE_PRESENT_ATTRIB_NAME = 'MustBePresent'
21   
22    __slots__ = ('__attributeId', '__issuer', '__mustBePresent')
23   
24    def __init__(self):
25        super(AttributeDesignator, self).__init__()
26        self.__attributeId = None
27        self.__issuer = None
28        self.__mustBePresent = False
29
30    @property
31    def attributeId(self):
32        """Get Attribute Id"""
33        return self.__attributeId
34
35    @attributeId.setter
36    def attributeId(self, value):
37        """Set Attribute Id"""
38        if not isinstance(value, basestring):
39            raise TypeError('Expecting %r type for "attributeId" '
40                            'attribute; got %r' % (basestring, type(value)))
41           
42        self.__attributeId = value 
43       
44    @property
45    def issuer(self):
46        """Get Issuer"""
47        return self.__issuer
48
49    @issuer.setter
50    def issuer(self, value):
51        """Set Issuer"""
52        if not isinstance(value, basestring):
53            raise TypeError('Expecting %r type for "issuer" '
54                            'attribute; got %r' % (basestring, type(value)))
55           
56        self.__issuer = value   
57
58    @property
59    def mustBePresent(self):
60        """Get Must Be Present flag"""
61        return self.__mustBePresent
62
63    @mustBePresent.setter
64    def mustBePresent(self, value):
65        """Set Must Be Present flag"""
66        if not isinstance(value, bool):
67            raise TypeError('Expecting %r type for "mustBePresent" '
68                            'attribute; got %r' % (bool, type(value)))
69           
70        self.__mustBePresent = value       
71       
72       
73class SubjectAttributeDesignator(AttributeDesignator):
74    """XACML Subject Attribute Designator type"""
75    ELEMENT_LOCAL_NAME = 'SubjectAttributeDesignator'
76       
77       
78class ResourceAttributeDesignator(AttributeDesignator):
79    """XACML Resource Attribute Designator type"""
80    ELEMENT_LOCAL_NAME = 'ResourceAttributeDesignator'
81   
82       
83class ActionAttributeDesignator(AttributeDesignator):
84    """XACML Action Attribute Designator type"""
85    ELEMENT_LOCAL_NAME = 'ActionAttributeDesignator'
86   
87   
88class EnvironmentAttributeDesignator(AttributeDesignator):
89    """XACML Environment Attribute Designator type"""
90    ELEMENT_LOCAL_NAME = 'EnvironmentAttributeDesignator'
Note: See TracBrowser for help on using the repository browser.