fix: checks for user before accessing properties in preferences update operation(#3844)
This commit is contained in:
@@ -14,6 +14,10 @@ async function update(args: PreferenceUpdateRequest) {
|
||||
value,
|
||||
} = args
|
||||
|
||||
if (!user) {
|
||||
throw new UnauthorizedError(req.t)
|
||||
}
|
||||
|
||||
const collection = 'payload-preferences'
|
||||
|
||||
const filter = {
|
||||
@@ -31,10 +35,6 @@ async function update(args: PreferenceUpdateRequest) {
|
||||
value,
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
throw new UnauthorizedError(req.t)
|
||||
}
|
||||
|
||||
if (!overrideAccess) {
|
||||
await executeAccess({ req }, defaultAccess)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user