Class: OdrlPolicyHelper
Helper methods for Odrl Policies.
Constructors
Constructor
new OdrlPolicyHelper():
OdrlPolicyHelper
Returns
OdrlPolicyHelper
Properties
CLASS_NAME
readonlystaticCLASS_NAME:string
The class name of the Policy Administration Point Service.
Methods
getUid()
staticgetUid(object):string|undefined
Get the UID of an ODRL policy or related object if available.
Parameters
object
object | undefined
The ODRL policy or related object to get the UID from.
Returns
string | undefined
The UID of the object if available, otherwise undefined.
getType()
staticgetType(object):string|undefined
Get the type of an ODRL policy or related object if available.
Parameters
object
object | undefined
The ODRL policy or related object to get the type from.
Returns
string | undefined
The type of the object if available, otherwise undefined.
extractAssigneeIdentity()
staticextractAssigneeIdentity(policy):ObjectOrArray<string>
Extract assignee identity from policy.
Parameters
policy
IDataspaceProtocolPolicy
The policy to extract the assignee from.
Returns
ObjectOrArray<string>
Assignee id.
Throws
GeneralError if assignee is missing or invalid.
extractAssignerIdentity()
staticextractAssignerIdentity(policy):ObjectOrArray<string>
Extract assigner identity from policy.
Parameters
policy
IDataspaceProtocolPolicy
The policy to extract the assigner from.
Returns
ObjectOrArray<string>
Assigner id.
Throws
GeneralError if assigner is missing or invalid.
getPartyIds()
staticgetPartyIds(party?):string[]
Normalize party value(s) into identifier strings when possible. Handles single parties or arrays of parties by returning all discovered identifiers.
Parameters
party?
string | IOdrlParty | IOdrlPartyCollection | (string | IOdrlParty | IOdrlPartyCollection)[]
The party to normalize.
Returns
string[]
The party identifiers, or undefined when not available.
getDatasetTargets()
staticgetDatasetTargets(policy):string[]
Get the dataset targets from policy.
Parameters
policy
The policy to extract the dataset targets from.
Returns
string[]
Top-level targets (deduped).
getTargets()
staticgetTargets(policy):string[]
Get targets from policy. Walks both the policy-level target field and the target field on every permission, prohibition, and obligation rule so that policies that store their target exclusively on a rule are correctly indexed for query().
Parameters
policy
The policy to extract the targets from.
Returns
string[]
Targets.
getActions()
staticgetActions(policy):string[]
Get actions from policy. Walks both the policy-level action field and the action field on every permission, prohibition, and obligation rule so that policies that store their action exclusively on a rule are correctly indexed for query().
Parameters
policy
The policy to extract the actions from.
Returns
string[]
Actions.
matchPolicy()
staticmatchPolicy(policy,options):boolean
Does the policy match.
Parameters
policy
IRightsManagementPolicy | undefined
The policy to try and match.
options
The matching options.
assignee?
string
The assignee to match.
assigner?
string
The assigner to match.
target?
string
The target to match.
action?
string
The action to match.
Returns
boolean
True if the policy matches.