MCPcopy
hub / github.com/joschan21/digitalhippo / isAdminOrHasAccessToImages

Function isAdminOrHasAccessToImages

src/collections/Media.ts:5–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4const isAdminOrHasAccessToImages =
5 (): Access =>
6 async ({ req }) => {
7 const user = req.user as User | undefined
8
9 if (!user) return false
10 if (user.role === 'admin') return true
11
12 return {
13 user: {
14 equals: req.user.id,
15 },
16 }
17 }
18
19export const Media: CollectionConfig = {
20 slug: 'media',

Callers 1

Media.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected