Constructor.
Optional
nodeIds: number[] | Set<number>the node IDs to restrict to, or undefined
for no restriction
Optional
sourceIds: string[] | Set<string>the source ID to restrict to, or undefined
for no restriction
Optional
aggregations: Aggregation[] | Set<Aggregation>the aggregation names to restrict to, or undefined
for no restriction
Optional
minAggregation: Aggregationif specified, a minimum aggregation level that is allowed
Optional
locationPrecisions: LocationPrecision[] | Set<LocationPrecision>the location precision names to restrict to, or undefined
for no restriction
Optional
minLocationPrecision: LocationPrecisionif specified, a minimum location precision that is allowed
Optional
nodeMetadataPaths: string[] | Set<string>the SolarNodeMetadata
paths to restrict to, or undefined
for no restriction
Optional
userMetadataPaths: string[] | Set<string>the UserNodeMetadata
paths to restrict to, or undefined
for no restriction
Get the minimum location precision.
the minimum precision, or undefined
Get the node IDs.
the node IDs, or undefined
Get the node metadata paths.
the node metadata paths, or undefined
Get the source IDs.
the source IDs, or undefined
Get the user metadata paths.
the user metadata paths, or undefined
Apply this policy's restrictions on a filter.
You can use this method to enforce aspects of a security policy on a SecurityPolicyFilter
.
For example:
const policy = SecurityPolicy.fromJsonObject({
nodeIds: [1, 2],
sourceIds: ["/s1/**"]
});
const filter = policy.restrict({
nodeIds: new Set([2, 3, 4]),
sourceIds: new Set(["/s1/a", "/s1/a/b", "/s2/a", "/s3/a"])
});
// now filter contains only the node/source IDs allowed by the policy:
{
nodeIds: new Set([2]),
sourceIds: new Set(["/s1/a", "/s1/a/b"])
};
the filter to enforce this policy's restrictions on
a new filter instance
Get this object as a standard JSON encoded string value.
This method calls Domain.SecurityPolicy#toJsonObject and then turns that into a JSON string.
the JSON encoded string
Get this object in standard JSON form.
An example result looks like this:
{
"nodeIds": [1,2,3],
"sourceIds": ["a", "b", "c"]
"aggregations": ["Hour"]
}
an object, ready for JSON encoding
Static
fromParse a JSON string into a Domain.SecurityPolicy instance.
The JSON must be encoded the same way Domain.SecurityPolicy#toJsonEncoding does.
the JSON to parse
the new instance, or undefined
if json
is undefined
Static
fromCreate a new instance from an object in standard JSON form.
The object must be in the same style as Domain.SecurityPolicy#toJsonObject produces.
the object in standard JSON form
the new instance, or undefined
if obj
is undefined
An immutable set of security restrictions that can be attached to other objects, like auth tokens.
Use the Domain.SecurityPolicyBuilder to create instances of this class with a fluent API.