source: TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/subject.py @ 7087

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/subject.py@7087
Revision 7087, 1.8 KB checked in by pjkersha, 10 years ago (diff)

Incomplete - task 2: XACML-Security Integration

  • updating epydoc ready for release.
  • Property svn:keywords set to Id
Line 
1"""NDG XACML Context Subject type
2
3NERC DataGrid
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.core.context import RequestChildBase
13
14
15class Subject(RequestChildBase):
16    """XACML Context Subject type
17   
18    @cvar ELEMENT_LOCAL_NAME: XML Local Name of this element
19    @type ELEMENT_LOCAL_NAME: string
20   
21    @cvar SUBJECT_CATEGORY_ATTRIB_NAME: subject category XML attribute name
22    @type SUBJECT_CATEGORY_ATTRIB_NAME: string
23   
24    @ivar __subjectCategory: subject category XML attribute name
25    @type __subjectCategory: string   
26    """
27    ELEMENT_LOCAL_NAME = 'Subject'
28    SUBJECT_CATEGORY_ATTRIB_NAME = 'SubjectCategory'
29   
30    __slots__ = ('__subjectCategory',)
31   
32    def __init__(self):
33        super(Subject, self).__init__()
34        self.__subjectCategory = None
35
36    def _get_subjectCategory(self):
37        """Get subject category
38       
39        @return: subject category XML attribute name
40        @rtype: string
41        """   
42        return self.__subjectCategory
43
44    def _set_subjectCategory(self, value):
45        """Set subject category
46       
47        @param value: subject category XML attribute name
48        @type value: string   
49       
50        @raise TypeError: incorrect type for input
51        """
52        if not isinstance(value, basestring):
53            raise TypeError('Expecting %r type for "subjectCategory" '
54                            'attribute; got %r' % (basestring, type(value)))
55           
56        self.__subjectCategory = value   
57
58    subjectCategory = property(_get_subjectCategory, _set_subjectCategory, None, 
59                               "Subject category")
Note: See TracBrowser for help on using the repository browser.