Entity
    Preparing search index...

    Class AllowIfInParentCascadeDeletionPrivacyPolicyRule<TFields, TIDField, TViewerContext, TEntity, TFields2, TIDField2, TEntity2, TPrivacyPolicy2, TSelectedFields, TSelectedFields2>

    A generic privacy policy rule that allows when an entity is being authorized as part of a cascading delete from a parent entity. Handles two cases:

    • When the field has not yet been null'ed out due to a cascading set null. This is often required for read rules to authorize the initial re-read of the entity being update set null'ed.
    • When the field has been null'ed out due to a cascading set null. This is often required the update rules for the field nullification.

    These two cases could theoretically be handled by two separate (stricter) rules, but are combined to simplify configuration since practically there are few cases where having them be combined would preset an issue.

    Billing info owned by an account, but records who created the billing info in creating_user_id. User is a member of that account. User can delete themselves, and the billing info's creating_user_id field is cascade set null'ed when the user is deleted.

     class BillingInfoEntityPrivacyPolicy extends EntityPrivacyPolicy<...> {
    protected override readonly readRules = [
    ...,
    new AllowIfInParentCascadeDeletionPrivacyPolicyRule<...>({
    fieldIdentifyingParentEntity: 'creating_user_id',
    parentEntityClass: UserEntity,
    }),
    ];

    protected override readonly updateRules = [
    ...,
    new AllowIfInParentCascadeDeletionPrivacyPolicyRule<...>({
    fieldIdentifyingParentEntity: 'creating_user_id',
    parentEntityClass: UserEntity,
    }),
    ];
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    Constructors

    Methods