Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -21,8 +21,6 @@ import jwt from "jsonwebtoken";
import { getUserInfo } from "~/utils/session.server";
import { evaluateFlagForContext } from "~/utils/services/.server/featureFlagEvaluator.server";
import { getTenantUserType } from "~/utils/db/tenants.db.server";
import { getRowById } from "~/utils/db/entities/rows.db.server";
import { getUserRowPermission } from "~/utils/helpers/.server/PermissionsService";
import { knowledgeBaseArticleBelongsToTenant } from "~/modules/knowledgeBase/db/kbArticles.db.server";
const TOKEN_TTL_SECONDS = 60 * 15; // 15 minutes — matches spec.
@@ -45,24 +43,13 @@ function isDocumentNamePart(value: unknown, options: { allowColon?: boolean } =
/**
* Resource-level authorization. Tenant membership alone is NOT sufficient:
* - "row" entities carry per-record ACLs (RowPermission), so a member could
* otherwise mint a collab token for a row they cannot read. Require at least
* read access to the specific row, scoped to the tenant.
* - "kb-article" content has no per-article ACL but must belong to the tenant,
* so a token can't be minted for a global/other-tenant article id.
* - Unknown resource types fail closed.
*/
async function isCollabResourceAuthorized(args: { userId: string; tenantId: string; resourceType: string; resourceId: string }): Promise<boolean> {
const { userId, tenantId, resourceType, resourceId } = args;
const { tenantId, resourceType, resourceId } = args;
switch (resourceType) {
case "row": {
const row = await getRowById(resourceId, { tenantId });
if (!row) {
return false;
}
const permission = await getUserRowPermission(row, tenantId, userId);
return permission.canRead === true || permission.canUpdate === true;
}
case "kb-article":
return await knowledgeBaseArticleBelongsToTenant(resourceId, tenantId);
default: