countModelWithPermissions
Function: countModelWithPermissions()
countModelWithPermissions(
model,query,context):Promise<QueryTotal>
Defined in: packages/core/src/models/permissions.ts:714
Count the objects a client query matches, as the caller
The client query is checked like queryModelWithPermissions (400 for a private field or a statement) and
counted with the model's permission query ANDed into it, without ORDER BY, LIMIT or OFFSET, up to
MAX_QUERY_COUNT. queryModelWithPermissions drops the rows refused by canAct after the store query, so a
store count would count rows the caller cannot read and reveal them: a total is only given when the model's static
getPermissionQuery(context) returns { partial: false }, its statement that the filter alone decides. The
statement only covers the canAct declared at or above the class declaring getPermissionQuery: no total is given
when the model or one of its subclasses overrides canAct below it (it may refuse rows the filter keeps).
Parameters
model
any
the model class
query
string
the client query
context
the caller context
Returns
Promise<QueryTotal>
the total, undefined when the model defines no permission check, its permission query is missing or
partial, or its store refuses an in-memory count (aggregationFallback: "deny")