Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Ignore empty/whitespace allowedEmailDomain
Richie McIlroycd971b407ce4
diff --git a/apps/web/__tests__/unit/videos-policy.test.ts b/apps/web/__tests__/unit/videos-policy.test.tsindex 036cd9d55..9dca40b7a 100644--- a/apps/web/__tests__/unit/videos-policy.test.ts+++ b/apps/web/__tests__/unit/videos-policy.test.ts@@ -246,6 +246,24 @@ describe("VideosPolicy.canView", () => {expect(await runCanView(deps, noUser)).toBe("allowed");});+ it("allows anonymous user when restriction is empty string", async () => {+ const deps = makeDeps({+ video: makeVideo({ public: true }),+ allowedEmailDomain: Option.some(""),+ });++ expect(await runCanView(deps, noUser)).toBe("allowed");+ });++ it("allows anonymous user when restriction is whitespace only", async () => {+ const deps = makeDeps({+ video: makeVideo({ public: true }),+ allowedEmailDomain: Option.some(" "),+ });++ expect(await runCanView(deps, noUser)).toBe("allowed");+ });+it("allows any logged-in user", async () => {const deps = makeDeps({video: makeVideo({ public: true }),diff --git a/packages/web-backend/src/Organisations/OrganisationsRepo.ts b/packages/web-backend/src/Organisations/OrganisationsRepo.tsindex b35bac4ef..73c75ccc1 100644--- a/packages/web-backend/src/Organisations/OrganisationsRepo.ts+++ b/packages/web-backend/src/Organisations/OrganisationsRepo.ts@@ -63,7 +63,7 @@ export class OrganisationsRepo extends Effect.Service<OrganisationsRepo>()(Effect.map(Array.get(0)),Effect.map(Option.flatMap((row) =>- Option.fromNullable(row.allowedEmailDomain),+ Option.fromNullable(row.allowedEmailDomain?.trim() || null),),),),diff --git a/packages/web-backend/src/Videos/VideosPolicy.ts b/packages/web-backend/src/Videos/VideosPolicy.tsindex 2ba7ecb31..dd45a8295 100644--- a/packages/web-backend/src/Videos/VideosPolicy.ts+++ b/packages/web-backend/src/Videos/VideosPolicy.ts@@ -80,9 +80,11 @@ export function buildCanView(}const allowedEmails = yield* orgsRepo.allowedEmailDomain(video.orgId);+ const restriction = Option.isSome(allowedEmails)+ ? allowedEmails.value.trim()+ : "";- if (Option.isSome(allowedEmails)) {- const restriction = allowedEmails.value;+ if (restriction.length > 0) {if (Option.isNone(user)) {yield* Effect.log("Email access restriction active and user not logged in. Access denied.",