domain/policy/policy-service
Classes
Section titled “Classes”PolicyService
Section titled “PolicyService”Defined in: app/src/domain/policy/policy-service.ts:66
Merges the values of all policy providers, validates them against the policy definitions and answers which value applies and whether a setting is locked.
Precedence: mandatory before recommended, and within a level machine before user. Sensitive policies are only applied from machine-wide mandatory sources. Invalid values are ignored and reported, never guessed.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PolicyService(
definitions,providers,logger,cache?):PolicyService
Defined in: app/src/domain/policy/policy-service.ts:88
Parameters
Section titled “Parameters”definitions
Section titled “definitions”readonly PolicyDefinition<unknown>[]
All known policies, including setting policies.
providers
Section titled “providers”readonly PolicyProvider[]
Sources for the current platform.
logger
Section titled “logger”Receives read problems.
cache?
Section titled “cache?”Optional fallback for providers that fail at startup.
Returns
Section titled “Returns”Properties
Section titled “Properties”onDidChange
Section titled “onDidChange”
readonlyonDidChange:Event<readonlystring[]>
Defined in: app/src/domain/policy/policy-service.ts:80
Fires with the names of policies whose effective value changed.
Methods
Section titled “Methods”applyCached()
Section titled “applyCached()”applyCached():
boolean
Defined in: app/src/domain/policy/policy-service.ts:123
Applies the last known policies from the cache, for the time until fresh values have been read.
Returns
Section titled “Returns”boolean
Whether the cache held a state; without one, nothing changes.
definitionForSetting()
Section titled “definitionForSetting()”definitionForSetting(
settingKey):PolicyDefinition<unknown> |undefined
Defined in: app/src/domain/policy/policy-service.ts:185
The policy that belongs to a setting.
Parameters
Section titled “Parameters”settingKey
Section titled “settingKey”string
A setting key.
Returns
Section titled “Returns”PolicyDefinition<unknown> | undefined
dispose()
Section titled “dispose()”dispose():
void
Defined in: app/src/domain/policy/policy-service.ts:209
Removes all listeners.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”getMandatory()
Section titled “getMandatory()”getMandatory(
name):EffectivePolicy|undefined
Defined in: app/src/domain/policy/policy-service.ts:156
The value that a mandatory policy forces, if any.
Parameters
Section titled “Parameters”string
Policy name.
Returns
Section titled “Returns”EffectivePolicy | undefined
getRecommended()
Section titled “getRecommended()”getRecommended(
name):EffectivePolicy|undefined
Defined in: app/src/domain/policy/policy-service.ts:177
The recommended default from policy, if any.
Parameters
Section titled “Parameters”string
Policy name.
Returns
Section titled “Returns”EffectivePolicy | undefined
isLocked()
Section titled “isLocked()”isLocked(
settingKey):boolean
Defined in: app/src/domain/policy/policy-service.ts:193
Tells whether a mandatory policy locks a setting.
Parameters
Section titled “Parameters”settingKey
Section titled “settingKey”string
A setting key.
Returns
Section titled “Returns”boolean
mandatoryValue()
Section titled “mandatoryValue()”mandatoryValue<
T>(definition):T|undefined
Defined in: app/src/domain/policy/policy-service.ts:164
The value that a mandatory policy forces, typed by its definition.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”definition
Section titled “definition”The policy, as registered with this service.
Returns
Section titled “Returns”T | undefined
readErrors()
Section titled “readErrors()”readErrors(): readonly
PolicyReadError[]
Defined in: app/src/domain/policy/policy-service.ts:204
Problems from the last refresh.
Returns
Section titled “Returns”readonly PolicyReadError[]
refresh()
Section titled “refresh()”refresh():
Promise<readonlystring[]>
Defined in: app/src/domain/policy/policy-service.ts:109
Reads all providers and applies the result. Calls made while a read is running share it.
Returns
Section titled “Returns”Promise<readonly string[]>
The names of policies whose effective value changed.
statuses()
Section titled “statuses()”statuses(): readonly
PolicyStatus[]
Defined in: app/src/domain/policy/policy-service.ts:199
Every value read in the last refresh, with its state.
Returns
Section titled “Returns”readonly PolicyStatus[]
Interfaces
Section titled “Interfaces”EffectivePolicy
Section titled “EffectivePolicy”Defined in: app/src/domain/policy/policy-service.ts:38
An applied policy value.
Properties
Section titled “Properties”
readonlyscope:PolicyScope
Defined in: app/src/domain/policy/policy-service.ts:40
source
Section titled “source”
readonlysource:string
Defined in: app/src/domain/policy/policy-service.ts:41
readonlyvalue:unknown
Defined in: app/src/domain/policy/policy-service.ts:39
PolicyCache
Section titled “PolicyCache”Defined in: app/src/domain/policy/policy-service.ts:45
Stores the last known raw values, used when a provider cannot be read at startup.
Methods
Section titled “Methods”read()
Section titled “read()”read(): readonly
RawPolicyValue[] |undefined
Defined in: app/src/domain/policy/policy-service.ts:47
Returns the cached values, or undefined when there is no usable cache.
Returns
Section titled “Returns”readonly RawPolicyValue[] | undefined
write()
Section titled “write()”write(
values):void
Defined in: app/src/domain/policy/policy-service.ts:52
Replaces the cached values.
Parameters
Section titled “Parameters”values
Section titled “values”readonly RawPolicyValue[]
The values just read from the providers.
Returns
Section titled “Returns”void
PolicyStatus
Section titled “PolicyStatus”Defined in: app/src/domain/policy/policy-service.ts:26
One policy value with the reason it was or was not applied.
Properties
Section titled “Properties”
readonlylevel:PolicyLevel
Defined in: app/src/domain/policy/policy-service.ts:29
message?
Section titled “message?”
readonlyoptionalmessage?:string
Defined in: app/src/domain/policy/policy-service.ts:34
Explanation for states other than applied.
readonlyname:string
Defined in: app/src/domain/policy/policy-service.ts:27
readonlyscope:PolicyScope
Defined in: app/src/domain/policy/policy-service.ts:30
source
Section titled “source”
readonlysource:string
Defined in: app/src/domain/policy/policy-service.ts:31
readonlystate:PolicyState
Defined in: app/src/domain/policy/policy-service.ts:32
readonlyvalue:unknown
Defined in: app/src/domain/policy/policy-service.ts:28
Type Aliases
Section titled “Type Aliases”PolicyState
Section titled “PolicyState”PolicyState =
"applied"|"overridden"|"invalid"|"unknown"|"not-allowed-as-recommended"|"sensitive-requires-machine"
Defined in: app/src/domain/policy/policy-service.ts:17
Outcome for one policy value, as listed on the diagnostics page.
Variables
Section titled “Variables”PolicyServiceToken
Section titled “PolicyServiceToken”
constPolicyServiceToken:Token<PolicyService>
Defined in: app/src/domain/policy/policy-service.ts:56
Token for the PolicyService.