prorm API Reference
    Preparing search index...

    Function filterByPermissions

    • Strip restricted fields from a plain object or model instance.

      Returns a new plain object with only the fields role is allowed to see. Does not mutate the original.

      Parameters

      • instance: any

        A model instance or plain record object

      • role: string

        The current user's role

      • OptionalModelClass: Function

        The model class (defaults to instance.constructor)

      Returns Record<string, any>