Skip to content

Commit 62672ce

Browse files
committed
logging
1 parent 5ac1a70 commit 62672ce

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

packages/web-backend/src/Videos/VideosPolicy.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export class VideosPolicy extends Effect.Service<VideosPolicy>()(
1818
Effect.fn(function* (user) {
1919
const res = yield* repo.getById(videoId);
2020

21-
if (Option.isNone(res)) return true;
21+
if (Option.isNone(res)) {
22+
yield* Effect.log("Video not found. Access granted.")
23+
return true;
24+
}
2225

2326
const [video, password] = res.value;
2427

@@ -40,11 +43,16 @@ export class VideosPolicy extends Effect.Service<VideosPolicy>()(
4043
if (
4144
Option.isNone(videoSpaceShareMembership) &&
4245
Option.isNone(videoOrgShareMembership)
43-
)
46+
) {
47+
yield* Effect.log("Neither org nor space sharing found. Access denied.")
4448
return false;
49+
}
4550
}
4651
} else {
47-
if (!video.public) return false;
52+
if (!video.public) {
53+
yield* Effect.log("Video is private and user is not logged in. Access denied.")
54+
return false;
55+
}
4856
}
4957

5058
yield* Video.verifyPassword(video, password);
@@ -73,4 +81,4 @@ export class VideosPolicy extends Effect.Service<VideosPolicy>()(
7381
SpacesRepo.Default,
7482
],
7583
},
76-
) {}
84+
) { }

0 commit comments

Comments
 (0)