Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Ethereal Engine. All Rights Reserved.
import { staticResourceFiltersQueryValidator } from '@etherealengine/engine/src/schemas/media/static-resource-filters.schema'
import { hooks as schemaHooks } from '@feathersjs/schema'

import { disallow, iff, isProvider } from 'feathers-hooks-common'
import verifyScope from '../../hooks/verify-scope'
import {
staticResourceFiltersExternalResolver,
Expand All @@ -38,16 +39,15 @@ export default {

before: {
all: [
verifyScope('admin', 'admin'),
() => schemaHooks.validateQuery(staticResourceFiltersQueryValidator),
schemaHooks.resolveQuery(staticResourceFiltersQueryResolver)
],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
find: [disallow()],
get: [iff(isProvider('external'), verifyScope('static_resource', 'read'))],
create: [disallow()],
update: [disallow()],
patch: [disallow()],
remove: [disallow()]
},
after: {
all: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All portions of the code written by the Ethereal Engine team are Copyright © 20
Ethereal Engine. All Rights Reserved.
*/
import { hooks as schemaHooks } from '@feathersjs/schema'
import { disallow } from 'feathers-hooks-common'
import { disallow, iff, isProvider } from 'feathers-hooks-common'

import {
staticResourceDataValidator,
Expand Down Expand Up @@ -79,24 +79,21 @@ export default {
() => schemaHooks.validateQuery(staticResourceQueryValidator),
schemaHooks.resolveQuery(staticResourceQueryResolver)
],
find: [collectAnalytics()],
find: [iff(isProvider('external'), verifyScope('static_resource', 'read')), collectAnalytics()],
get: [disallow('external')],
create: [
iff(isProvider('external'), verifyScope('static_resource', 'write')),
setLoggedinUserInBody('userId'),
verifyScope('admin', 'admin'),
() => schemaHooks.validateData(staticResourceDataValidator),
schemaHooks.resolveData(staticResourceDataResolver)
],
update: [verifyScope('admin', 'admin')],
update: [disallow()],
patch: [
verifyScope('admin', 'admin'),
iff(isProvider('external'), verifyScope('static_resource', 'write')),
() => schemaHooks.validateData(staticResourcePatchValidator),
schemaHooks.resolveData(staticResourcePatchResolver)
],
remove: [
// iff(isProvider('external'), verifyScope('admin', 'admin') as any),
ensureResource
]
remove: [iff(isProvider('external'), verifyScope('static_resource', 'write')), ensureResource]
},

after: {
Expand Down