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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/__init__.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 package defines classes for types in the access control
2context schema
3
4NERC DataGrid
5"""
6__author__ = "P J Kershaw"
7__date__ = "24/03/10"
8__copyright__ = "(C) 2010 Science and Technology Facilities Council"
9__contact__ = "Philip.Kershaw@stfc.ac.uk"
10__license__ = "BSD - see LICENSE file in top-level directory"
11__contact__ = "Philip.Kershaw@stfc.ac.uk"
12__revision__ = "$Id$"
13from ndg.xacml.utils import TypedList
14from ndg.xacml.core import XacmlCoreBase
15from ndg.xacml.core.attribute import Attribute
16
17
18class XacmlContextBase(XacmlCoreBase):
19    """Base class for XACML Request and Response types
20   
21    @cvar ELEMENT_LOCAL_NAME: XML local element name, derived classes should
22    set
23    @type ELEMENT_LOCAL_NAME: None"""
24    ELEMENT_LOCAL_NAME = None
25    __slots__ = ()
26   
27    def __init__(self):
28        """ELEMENT_LOCAL_NAME check makes this class virtual - derived classes
29        must override this method and set ELEMENT_LOCAL_NAME to the appropriate
30        string
31        """
32        if self.__class__.ELEMENT_LOCAL_NAME is None:
33            raise NotImplementedError('Set "ELEMENT_LOCAL_NAME" in a derived '
34                                      'type')
35   
36   
37class RequestChildBase(XacmlContextBase):
38    """Base class for XACML Context Subject, Resource, Action and Environment
39    types
40   
41    @ivar __attributes: XACML Context subject attributes
42    @type __attributes: ndg.xacml.utils.TypedList
43    """
44    __slots__ = ('__attributes', )
45   
46    def __init__(self):
47        """Initialise attribute list"""
48        self.__attributes = TypedList(Attribute)
49       
50    @property
51    def attributes(self):
52        """
53        @return: XACML Context subject attributes
54        @rtype: ndg.xacml.utils.TypedList
55        """
56        return self.__attributes
57   
Note: See TracBrowser for help on using the repository browser.