mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[AuthorizationManager] use a new NotAuthorizedError
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
/* eslint-disable
|
||||
camelcase,
|
||||
*/
|
||||
const { NotAuthorizedError } = require('./Errors')
|
||||
|
||||
let AuthorizationManager
|
||||
module.exports = AuthorizationManager = {
|
||||
assertClientCanViewProject(client, callback) {
|
||||
@@ -23,7 +25,7 @@ module.exports = AuthorizationManager = {
|
||||
if (allowedLevels.includes(client.ol_context.privilege_level)) {
|
||||
callback(null)
|
||||
} else {
|
||||
callback(new Error('not authorized'))
|
||||
callback(new NotAuthorizedError())
|
||||
}
|
||||
},
|
||||
|
||||
@@ -49,7 +51,7 @@ module.exports = AuthorizationManager = {
|
||||
if (client.ol_context[`doc:${doc_id}`] === 'allowed') {
|
||||
callback(null)
|
||||
} else {
|
||||
callback(new Error('not authorized'))
|
||||
callback(new NotAuthorizedError())
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ class MissingSessionError extends OError {
|
||||
}
|
||||
}
|
||||
|
||||
class NotAuthorizedError extends OError {
|
||||
constructor() {
|
||||
super('not authorized')
|
||||
}
|
||||
}
|
||||
|
||||
class NullBytesInOpError extends OError {
|
||||
constructor(jsonChange) {
|
||||
super('null bytes found in op', { jsonChange })
|
||||
@@ -37,6 +43,7 @@ module.exports = {
|
||||
CodedError,
|
||||
DataTooLargeToParseError,
|
||||
MissingSessionError,
|
||||
NotAuthorizedError,
|
||||
NullBytesInOpError,
|
||||
UpdateTooLargeError
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user