Changeset 6643 for TI12-security/trunk/NDGSecurity
- Timestamp:
- 25/02/10 16:39:54 (11 years ago)
- Location:
- TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/__init__.py
r6621 r6643 5 5 __slots__ = ('__xmlns', ) 6 6 7 ELEMENT_LOCAL_NAME = None 8 7 9 def __init__(self): 8 10 self.__xmlns = PolicyComponent.XACML_2_0_XMLNS … … 23 25 def isValidXmlns(self): 24 26 return self.xmlns in PolicyComponent.XMLNS 27 28 29 class RequestPropertyBase(PolicyComponent): 30 """Base type for Subject, Resource, Action and Environment types""" 31 MATCH_TYPE = None 32 33 __slots__ = ('__matches', ) 34 35 def __init__(self): 36 # Derived types can specify the type for matches via the MATCH_TYPE 37 # class variable 38 self.__matches = TypedList(self.__class__.MATCH_TYPE) 39 40 @property 41 def matches(self): 42 return self.__matches -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/action.py
r6621 r6643 4 4 @author: pjkersha 5 5 ''' 6 from ndg.security.common.authz.xacml import PolicyComponent 6 from ndg.security.common.authz.xacml import RequestPropertyBase 7 from ndg.security.common.authz.xacml.match import ActionMatch 7 8 8 class Action(PolicyComponent): 9 pass 9 10 class Action(RequestPropertyBase): 11 MATCH_TYPE = ActionMatch 12 ELEMENT_LOCAL_NAME = 'Action' 13 14 __slots__ = () 15 16 @property 17 def actionMatches(self): 18 return self.matches -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/environment.py
r6621 r6643 4 4 @author: pjkersha 5 5 ''' 6 from ndg.security.common.authz.xacml import PolicyComponent 6 from ndg.security.common.authz.xacml import RequestPropertyBase 7 from ndg.security.common.authz.xacml.match import EnvironmentMatch 7 8 8 class Environment(PolicyComponent): 9 pass 9 10 class Environment(RequestPropertyBase): 11 MATCH_TYPE = EnviornmentMatch 12 ELEMENT_LOCAL_NAME = 'Environment' 13 14 __slots__ = () 15 16 @property 17 def environmentMatches(self): 18 return self.matches -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/policy.py
r6642 r6643 137 137 def obligations(self): 138 138 return self.__obligations 139 140 def _getPolicyFilePath(self):141 return self.__policyFilePath142 143 def _setPolicyFilePath(self, value):144 if not isinstance(value, basestring):145 raise TypeError('Expecting string type for "policyFilePath" '146 'attribute; got %r' % type(value))147 148 self.__policyFilePath = value149 150 policyFilePath = property(_getPolicyFilePath, _setPolicyFilePath,151 doc="Policy file path")152 139 153 140 def _getTargets(self): -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/resource.py
r6621 r6643 5 5 ''' 6 6 from ndg.security.common.authz.xacml import PolicyComponent 7 from ndg.security.common.authz.xacml.match import ResourceMatch 7 8 8 class Resource(PolicyComponent):9 pass10 9 10 class Resource(RequestPropertyBase): 11 MATCH_TYPE = ResourceMatch 12 ELEMENT_LOCAL_NAME = 'Resource' 13 14 __slots__ = () 15 16 @property 17 def resourceMatches(self): 18 return self.matches -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/rule.py
r6621 r6643 7 7 from ndg.security.common.authz.xacml import PolicyComponent 8 8 from ndg.security.common.authz.xacml.target import Target 9 from ndg.security.common.authz.xacml.condition import Condition 9 10 10 11 11 12 class Rule(PolicyComponent): 12 __slots__ = ('__target',) 13 """XACML Policy Rule""" 14 ELEMENT_LOCAL_NAME = 'Rule' 15 16 __slots__ = ( 17 '__targets', 18 '__conditions', 19 '__description', 20 '__id', 21 '__effect' 22 ) 13 23 14 24 def __init__(self): 25 self.__id = None 26 self.__effect = None 15 27 self.__targets = TypedList(Target) 28 self.__conditions = TypedList(Condition) 16 29 17 30 @property … … 19 32 "list of Rule targets" 20 33 return self.__targets 34 35 @property 36 def conditions(self): 37 "list of rule conditions" 38 return self.__conditions 39 40 def _get_id(self): 41 return self.__id 21 42 43 def _set_id(self, value): 44 if not isinstance(value, basestring): 45 raise TypeError('Expecting %r type for "id" ' 46 'attribute; got %r' % (basestring, type(value))) 47 48 self.__id = value 49 50 id = property(_get_id, _set_id, None, "Rule identifier attribute") 51 52 def _get_effect(self): 53 return self.__effect 54 55 def _set_effect(self, value): 56 if not isinstance(value, basestring): 57 raise TypeError('Expecting %r type for "effect" ' 58 'attribute; got %r' % (basestring, type(value))) 59 60 self.__effect = value 61 62 effect = property(_get_effect, _set_effect, None, 63 "Rule effect attribute") 64 65 def _getDescription(self): 66 return self.__description 67 68 def _setDescription(self, value): 69 if not isinstance(value, basestring): 70 raise TypeError('Expecting string type for "description" ' 71 'attribute; got %r' % type(value)) 72 self.__description = value 73 74 description = property(_getDescription, _setDescription, 75 doc="Rule Description text") -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/subject.py
r6621 r6643 5 5 ''' 6 6 from ndg.security.common.authz.xacml import PolicyComponent 7 from ndg.security.common.authz.xacml.match import SubjectMatch 7 8 8 class Subject(PolicyComponent): 9 pass 9 class Subject(RequestPropertyBase): 10 MATCH_TYPE = SubjectMatch 11 ELEMENT_LOCAL_NAME = 'Subject' 12 13 __slots__ = () 14 15 @property 16 def subjectMatches(self): 17 return self.matches -
TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/authz/xacml/target.py
r6621 r6643 5 5 ''' 6 6 from ndg.security.common.utils import TypedList 7 from ndg.security.common.authz.xacml import PolicyComponent 7 8 from ndg.security.common.authz.xacml.action import Action 8 9 from ndg.security.common.authz.xacml.resource import Resource … … 47 48 '__attributes', 48 49 '__regEx' 49 ) 50 ) 51 50 52 def __init__(self): 51 53 super(Target, self).__init__()
Note: See TracChangeset
for help on using the changeset viewer.