mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[AuthorizationManager] use a new NotAuthorizedError
This commit is contained in:
parent
de518ea4eb
commit
a8c51de510
2 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue