Preparing search index...
The search index is not available Entity
Class EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>Abstract
Type Parameters
TFields extends object
TID extends NonNullable < TFields [ TSelectedFields ] >
TEntity extends ReadonlyEntity < TFields , TID , TViewerContext , TSelectedFields >
TSelectedFields extends keyof TFields = keyof TFields
Constructors
constructor
new Entity Privacy Policy < TFields , TID , TViewerContext , TEntity , TSelectedFields > ( ) : EntityPrivacyPolicy < TFields , TID , TViewerContext , TEntity , TSelectedFields >
Type Parameters
TFields extends object
TID extends {}
TViewerContext extends ViewerContext < TViewerContext >
TEntity extends ReadonlyEntity < TFields , TID , TViewerContext , TSelectedFields , TEntity >
TSelectedFields extends string | number | symbol = keyof TFields
Returns EntityPrivacyPolicy < TFields , TID , TViewerContext , TEntity , TSelectedFields >
Properties
Protected
Readonly
create Rules
create Rules : readonly PrivacyPolicyRule < TFields , TID , TViewerContext , TEntity , TSelectedFields > [] = []
Protected
Readonly
delete Rules
delete Rules : readonly PrivacyPolicyRule < TFields , TID , TViewerContext , TEntity , TSelectedFields > [] = []
Protected
Readonly
read Rules
read Rules : readonly PrivacyPolicyRule < TFields , TID , TViewerContext , TEntity , TSelectedFields > [] = []
Protected
Readonly
update Rules
update Rules : readonly PrivacyPolicyRule < TFields , TID , TViewerContext , TEntity , TSelectedFields > [] = []
Methods
authorize Create Async
authorize Create Async ( viewerContext , queryContext , evaluationContext , entity , metricsAdapter ) : Promise < TEntity >
Parameters
viewerContext : TViewerContext
entity : TEntity
Returns Promise < TEntity > entity if authorized
authorize Delete Async
authorize Delete Async ( viewerContext , queryContext , evaluationContext , entity , metricsAdapter ) : Promise < TEntity >
Parameters
viewerContext : TViewerContext
entity : TEntity
Returns Promise < TEntity > entity if authorized
Private
authorize For Ruleset Async
authorize For Ruleset Async ( ruleset , viewerContext , queryContext , evaluationContext , entity , action , metricsAdapter ) : Promise < TEntity >
Parameters
ruleset : readonly PrivacyPolicyRule < TFields , TID , TViewerContext , TEntity , TSelectedFields > []
viewerContext : TViewerContext
entity : TEntity
Returns Promise < TEntity >
Private
authorize For Ruleset Inner Async
authorize For Ruleset Inner Async ( ruleset , viewerContext , queryContext , evaluationContext , entity , action ) : Promise < TEntity >
Parameters
ruleset : readonly PrivacyPolicyRule < TFields , TID , TViewerContext , TEntity , TSelectedFields > []
viewerContext : TViewerContext
entity : TEntity
Returns Promise < TEntity >
authorize Read Async
authorize Read Async ( viewerContext , queryContext , evaluationContext , entity , metricsAdapter ) : Promise < TEntity >
Parameters
viewerContext : TViewerContext
entity : TEntity
Returns Promise < TEntity > entity if authorized
authorize Update Async
authorize Update Async ( viewerContext , queryContext , evaluationContext , entity , metricsAdapter ) : Promise < TEntity >
Parameters
viewerContext : TViewerContext
entity : TEntity
Returns Promise < TEntity > entity if authorized
Protected
get Privacy Policy Evaluator
Privacy policy for an entity.
Remarks
A privacy policy declares lists of PrivacyPolicyRule for create, read, update, and delete actions for an entity and provides logic for authorizing an entity against rules.
Evaluation of a list of rules is performed according the following example. This allows constructing of complex yet testable permissioning logic for an entity.
Example