Package ndg :: Package xacml :: Package core :: Module policy :: Class Policy
[hide private]

Class Policy

source code

       object --+        
                |        
    XacmlCoreBase --+    
                    |    
policybase.PolicyBase --+
                        |
                       Policy

XACML Policy

Nested Classes [hide private]

Inherited from policybase.PolicyBase: __metaclass__

Instance Methods [hide private]
 
__init__(self, ruleCombiningAlgFactory=None)
Customise rule combining behaviour by passing in a custom combining algorithm factory.
source code
NoneType / ndg.xacml.core.rule_combining_alg.RuleCombiningAlgClassFactory
_getRuleCombiningAlgFactory(self)
Returns: rule combining algorithm factory
source code
 
_setRuleCombiningAlgFactory(self, value) source code
NoneType / basestring
_getPolicyId(self)
Returns: policy id
source code
 
_setPolicyId(self, value) source code
NoneType / basestring
_getVersion(self)
Returns: policy version
source code
 
_setVersion(self, value) source code
NoneType / basestring
_getRuleCombiningAlgId(self)
Returns: rule combining algorithm ID
source code
 
_setRuleCombiningAlgId(self, value) source code
 
_setRuleCombiningAlgFromId(self)
Set the rule combining algorithm implementation from the Id set in __ruleCombiningAlgId the attribute
source code
NoneType / ndg.xacml.core.target.Target
_getTarget(self)
Returns: target element
source code
 
_setTarget(self, value) source code
NoneType / basestring
_getDescription(self)
Returns: policy description text
source code
 
_setDescription(self, value) source code
NoneType / ndg.xacml.core.policydefaults.PolicyDefaults
_getPolicyDefaults(self)
Returns: policy defaults
source code
 
_setPolicyDefaults(self, value) source code
ndg.xacml.core.context.result.Decision
evaluateCombiningAlgorithm(self, context)
Evaluates the rule combining algorithm for this policy.
source code

Inherited from policybase.PolicyBase: evaluate, evaluateResponse

Inherited from XacmlCoreBase: __getstate__

Inherited from XacmlCoreBase (private): _getXmlns, _setXmlns

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
ndg.xacml.core.policy.Policy
fromSource(cls, source, readerFactory)
Create a new policy from the input source parsing it using a reader from the required reader factory e.g.
source code

Inherited from policybase.PolicyBase: fromNestedSource

Class Variables [hide private]
string DEFAULT_XACML_VERSION = '2.0'
default is 2.0
NoneType but implement as string in derived classes ELEMENT_LOCAL_NAME = 'Policy'
XML element local name for the given type
string POLICY_ID_ATTRIB_NAME = 'PolicyId'
policy id XML attribute name
string RULE_COMBINING_ALG_ID_ATTRIB_NAME = 'RuleCombiningAlgId'
rule combining algorithm id XML attribute name
string VERSION_ATTRIB_NAME = 'Version'
version XML attribute name
string DESCRIPTION_LOCAL_NAME = 'Description'
description XML element local name
string POLICY_DEFAULTS_LOCAL_NAME = 'PolicyDefaults'
policy defaults XML element local name
string COMBINER_PARAMETERS_LOCAL_NAME = 'CombinerParameters'
combiner parameter XML element local name
string RULE_COMBINER_PARAMETERS_LOCAL_NAME = 'RuleCombinerParameters'
rule combiner parameter XML element local name
string OBLIGATIONS_LOCAL_NAME = 'Obligations'
obligations XML element local name
  POLICY_ID_REFERENCE = 'PolicyIdReference'
  __abstractmethods__ = frozenset([])

Inherited from XacmlCoreBase: XACML_1_0_NS_PREFIX, XACML_2_0_NS_PREFIX, XMLNS

Instance Variables [hide private]
ndg.xacml.utils.TypedList __attr
list of rules
NoneType / basestring __description
policy decription text
ndg.xacml.utils.TypedList __obligations
obligations
NoneType / basestring __policyId
policy id
NoneType / ndg.xacml.core.rule_combining_alg.RuleCombiningAlgInterface __ruleCombiningAlg
rule combining algorithm
ndg.xacml.core.rule_combining_alg.RuleCombiningAlgClassFactory __ruleCombiningAlgFactory
rule combining algorithm factory
NoneType / basestring __ruleCombiningAlgId
rule combining algorithm ID
NoneType / ndg.xacml.core.target.Target __target
target element
NoneType / basestring __version
policy version
Properties [hide private]
  ruleCombiningAlgFactory
Rule Combining Algorithm Factory
ndg.xacml.core.rule_combining_alg.RuleCombiningAlgInterface derived type ruleCombiningAlg
Rule Combining algorithm
  policyId
Policy Id
  ident
Policy Id
  version
Policy Version
  ruleCombiningAlgId
Rule Combining Algorithm Id
  combinerParameters
  ruleCombinerParameters
  variableDefinitions
ndg.xacml.utils.TypedList rules
Return the list of rules
ndg.xacml.utils.TypedList obligations
  target
list of Policy targets
  description
Policy Description text
  policyDefaults
Policy PolicyDefaults element
  __policyDefaults

Inherited from XacmlCoreBase: elem, isValidXmlns, xmlns

Inherited from object: __class__

Method Details [hide private]

__init__(self, ruleCombiningAlgFactory=None)
(Constructor)

source code 

Customise rule combining behaviour by passing in a custom combining algorithm factory. This is invoked when the combining algorithm Id property is set in order to create the corresponding combining algorithm object

Parameters:
  • ruleCombiningAlgFactory (NoneType / defaults to ndg.xacml.core.rule_combining_alg.RuleCombiningAlgClassFactory) - factory object for return a rule combining algorithm class for a given URI. Defaults to
Raises:
  • NotImplementedError - derived classes must set ELEMENT_LOCAL_NAME to a string
Overrides: object.__init__

_getRuleCombiningAlgFactory(self)

source code 
Returns: NoneType / ndg.xacml.core.rule_combining_alg.RuleCombiningAlgClassFactory
rule combining algorithm factory

_setRuleCombiningAlgFactory(self, value)

source code 
Parameters:
  • value (ndg.xacml.core.rule_combining_alg.RuleCombiningAlgClassFactory) - rule combining algorithm factory
Raises:
  • TypeError - incorrect input type

fromSource(cls, source, readerFactory)
Class Method

source code 

Create a new policy from the input source parsing it using a reader from the required reader factory e.g. ETreeReaderFactory to use ElementTree based parsing

Parameters:
  • source (string, file, XML node type) - source from which to read the policy - file path, file object, XML node or other dependent on the reader factory selected
  • readerFactory (ndg.xacml.parsers.AbstractReaderFactory) - factory class returns reader class used to parse the policy
Returns: ndg.xacml.core.policy.Policy
new policy instance
Overrides: policybase.PolicyBase.fromSource

_getPolicyId(self)

source code 
Returns: NoneType / basestring
policy id

_setPolicyId(self, value)

source code 
Parameters:
  • value (basestring) - policy id
Raises:
  • TypeError - incorrect input type

_getVersion(self)

source code 
Returns: NoneType / basestring
policy version

_setVersion(self, value)

source code 
Parameters:
  • value (basestring) - policy version
Raises:
  • TypeError - incorrect input type

_getRuleCombiningAlgId(self)

source code 
Returns: NoneType / basestring
rule combining algorithm ID

_setRuleCombiningAlgId(self, value)

source code 
Parameters:
  • value (NoneType / basestring) - rule combining algorithm ID
Raises:
  • TypeError - incorrect input type

_setRuleCombiningAlgFromId(self)

source code 

Set the rule combining algorithm implementation from the Id set in __ruleCombiningAlgId the attribute

Raises:

_getTarget(self)

source code 
Returns: NoneType / ndg.xacml.core.target.Target
target element

_setTarget(self, value)

source code 
Parameters:
  • value (ndg.xacml.core.target.Target) - target element
Raises:
  • TypeError - incorrect input type

_getDescription(self)

source code 
Returns: NoneType / basestring
policy description text

_setDescription(self, value)

source code 
Parameters:
  • value (basestring) - policy description text
Raises:
  • TypeError - incorrect input type

_getPolicyDefaults(self)

source code 
Returns: NoneType / ndg.xacml.core.policydefaults.PolicyDefaults
policy defaults

_setPolicyDefaults(self, value)

source code 
Parameters:
  • value (ndg.xacml.core.policydefaults.PolicyDefaults) - policy defaults
Raises:
  • TypeError - incorrect input type

evaluateCombiningAlgorithm(self, context)

source code 

Evaluates the rule combining algorithm for this policy.

Parameters:
  • context (ndg.xacml.core.request.Request) - the request context
Returns: ndg.xacml.core.context.result.Decision
result of the evaluation - the decision for this policy
Overrides: policybase.PolicyBase.evaluateCombiningAlgorithm

Property Details [hide private]

ruleCombiningAlgFactory

Rule Combining Algorithm Factory

Get Method:
_getRuleCombiningAlgFactory(self) - Returns: rule combining algorithm factory
Set Method:
_setRuleCombiningAlgFactory(self, value)

ruleCombiningAlg

Rule Combining algorithm

Get Method:
unreachable.ruleCombiningAlg(self) - Rule Combining algorithm
Type:
ndg.xacml.core.rule_combining_alg.RuleCombiningAlgInterface derived type

policyId

Policy Id

Get Method:
_getPolicyId(self) - Returns: policy id
Set Method:
_setPolicyId(self, value)

ident

Policy Id

Get Method:
_getPolicyId(self) - Returns: policy id

version

Policy Version

Get Method:
_getVersion(self) - Returns: policy version
Set Method:
_setVersion(self, value)

ruleCombiningAlgId

Rule Combining Algorithm Id

Get Method:
_getRuleCombiningAlgId(self) - Returns: rule combining algorithm ID
Set Method:
_setRuleCombiningAlgId(self, value)

combinerParameters

Get Method:
unreachable.combinerParameters(self)

ruleCombinerParameters

Get Method:
unreachable.ruleCombinerParameters(self)

variableDefinitions

Get Method:
unreachable.variableDefinitions(self)

rules

Return the list of rules

Get Method:
unreachable.rules(self) - Return the list of rules
Type:
ndg.xacml.utils.TypedList

obligations

Get Method:
unreachable.obligations(self) - Returns: obligations
Type:
ndg.xacml.utils.TypedList

target

list of Policy targets

Get Method:
_getTarget(self) - Returns: target element
Set Method:
_setTarget(self, value)

description

Policy Description text

Get Method:
_getDescription(self) - Returns: policy description text
Set Method:
_setDescription(self, value)

policyDefaults

Policy PolicyDefaults element

Get Method:
_getPolicyDefaults(self) - Returns: policy defaults
Set Method:
_setPolicyDefaults(self, value)