Class EntityPrivacyPolicy<TFields, TIDField, TViewerContext, TEntity, TSelectedFields>Abstract
Constructors constructor new EntityPrivacyPolicy < TFields extends Record < string , any > , TIDField extends string | number | symbol , TViewerContext extends ViewerContext , TEntity extends ReadonlyEntity < TFields , TIDField , TViewerContext , TSelectedFields > , TSelectedFields extends string | number | symbol = keyof TFields , > () : EntityPrivacyPolicy < TFields , TIDField , TViewerContext , TEntity , TSelectedFields , > Properties Protected
Readonly
createRules Protected
Readonly
deleteRules Protected
Readonly
readRules Protected
Readonly
updateRules Methods authorizeCreateAsync authorizeCreateAsync ( viewerContext : TViewerContext , queryContext : EntityQueryContext , evaluationContext : EntityPrivacyPolicyEvaluationContext < TFields , TIDField , TViewerContext , TEntity , TSelectedFields , > , entity : TEntity , metricsAdapter : IEntityMetricsAdapter , ) : Promise < TEntity > Returns Promise < TEntity > entity if authorized
authorizeDeleteAsync authorizeDeleteAsync ( viewerContext : TViewerContext , queryContext : EntityQueryContext , evaluationContext : EntityPrivacyPolicyEvaluationContext < TFields , TIDField , TViewerContext , TEntity , TSelectedFields , > , entity : TEntity , metricsAdapter : IEntityMetricsAdapter , ) : Promise < TEntity > Returns Promise < TEntity > entity if authorized
authorizeReadAsync authorizeReadAsync ( viewerContext : TViewerContext , queryContext : EntityQueryContext , evaluationContext : EntityPrivacyPolicyEvaluationContext < TFields , TIDField , TViewerContext , TEntity , TSelectedFields , > , entity : TEntity , metricsAdapter : IEntityMetricsAdapter , ) : Promise < TEntity > Returns Promise < TEntity > entity if authorized
authorizeUpdateAsync authorizeUpdateAsync ( viewerContext : TViewerContext , queryContext : EntityQueryContext , evaluationContext : EntityPrivacyPolicyEvaluationContext < TFields , TIDField , TViewerContext , TEntity , TSelectedFields , > , entity : TEntity , metricsAdapter : IEntityMetricsAdapter , ) : Promise < TEntity > Returns Promise < TEntity > entity if authorized
Protected
getPrivacyPolicyEvaluator
M M N E P V F C I C P M F P C P T T A A A T R
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