Member Junction
    Preparing search index...

    Function ProjectEntityValuesForUser

    • Projects a plain object of entity field values down to what user may READ.

      The one output projection every transport uses, so that no transport can apply only half of it. Three things are applied, matching what the GraphQL resolvers' field mapping does:

      1. Denied read fields are omitted, under both the Name and CodeName spellings and in any case, because callers reach here with rows keyed either way. Omitted rather than nulled: a null is indistinguishable from a real value.
      2. ReadableFieldsTransportKey is appended when includeReadableFields is set and the caller is denied something (see the option).
      3. The Record Changes payload projection, which is keyed on the entity each ROW is about rather than on the entity being queried. MJ: Record Changes normally has field security off, so step 1 is a no-op for it, while its payload columns carry other entities' values.

      An entity object built for a restricted user does not hold denied values in the first place, so on that path this is defence in depth. It is the primary control for values that did not come from such an object: a system-identity load, a raw provider row, or a cached payload.

      Returns a COPY whenever anything changed, and the original object by reference when nothing did, so unrestricted callers pay nothing and frozen cache rows are never written to.

      Type Parameters

      • T extends object

      Parameters

      • provider: RecordChangeMetadataSource

        Metadata source, used to resolve the per-row target entity for Record Changes.

      • entityInfo: EntityInfo

        The entity the values belong to. When absent the values are returned unchanged.

      • values: T

        The field values. Never modified. Fails open on a missing user. With no user the values are returned unchanged, full width. That is deliberate: a browser or other single-user client has no per-call user to pass, and server-internal code running without one is trusted with full values. It also means a server-side transport that forgets to pass the caller sends everything, so every request-path caller must pass the requesting user.

      • user: UserInfo

        The caller. When absent the values are returned unchanged (see above).

      • Optionaloptions: ProjectEntityValuesOptions

      Returns T