form hooks should only be queryable for form admins
This commit is contained in:
parent
b3cacb8481
commit
7ea4f51f4b
@ -30,6 +30,8 @@ Template for next version
|
||||
|
||||
### Security
|
||||
|
||||
- form hooks should only be queryable for form admins
|
||||
|
||||
## [1.0.2] - 2022-03-13
|
||||
|
||||
### Fixed
|
||||
|
||||
@ -43,6 +43,7 @@ export class FormResolver {
|
||||
}
|
||||
|
||||
@ResolveField(() => [FormHookModel])
|
||||
@Roles('admin')
|
||||
async hooks(
|
||||
@User() user: UserEntity,
|
||||
@Parent() parent: FormModel,
|
||||
@ -50,6 +51,10 @@ export class FormResolver {
|
||||
): Promise<FormHookModel[]> {
|
||||
const form = await cache.get<FormEntity>(cache.getCacheKey(FormEntity.name, parent._id))
|
||||
|
||||
if (!this.formService.isAdmin(form, user)) {
|
||||
throw new Error('no access to field')
|
||||
}
|
||||
|
||||
return form.hooks?.map(hook => new FormHookModel(hook)) || []
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user