diff --git a/x-pack/plugins/code/public/reducers/user.ts b/x-pack/plugins/code/public/reducers/user.ts index 6c352029eff97..95f99f356979a 100644 --- a/x-pack/plugins/code/public/reducers/user.ts +++ b/x-pack/plugins/code/public/reducers/user.ts @@ -31,7 +31,10 @@ export const userProfile = handleActions( if (action.payload!.roles) { // If security is enabled and the roles field is set. Then we should check the // 'code_admin' and 'code_user' roles. - draft.isCodeAdmin = action.payload!.roles.includes('code_admin'); + draft.isCodeAdmin = + action.payload!.roles.includes('code_admin') || + // 'superuser' should be deemed as code admin user as well. + action.payload!.roles.includes('superuser'); draft.isCodeUser = action.payload!.roles.includes('code_user'); } else { // If security is not enabled, then every user is code admin. diff --git a/x-pack/plugins/code/server/lib/esqueue/helpers/errors.js b/x-pack/plugins/code/server/lib/esqueue/helpers/errors.js index 716d0285217a1..b8be62d5ad455 100644 --- a/x-pack/plugins/code/server/lib/esqueue/helpers/errors.js +++ b/x-pack/plugins/code/server/lib/esqueue/helpers/errors.js @@ -10,7 +10,7 @@ export function WorkerTimeoutError(message, props = {}) { this.timeout = props.timeout; this.jobId = props.jobId; - if ("captureStackTrace" in Error) Error.captureStackTrace(this, WorkerTimeoutError); + if ('captureStackTrace' in Error) Error.captureStackTrace(this, WorkerTimeoutError); else this.stack = (new Error()).stack; } WorkerTimeoutError.prototype = Object.create(Error.prototype); @@ -20,7 +20,7 @@ export function UnspecifiedWorkerError(message, props = {}) { this.message = message; this.jobId = props.jobId; - if ("captureStackTrace" in Error) Error.captureStackTrace(this, UnspecifiedWorkerError); + if ('captureStackTrace' in Error) Error.captureStackTrace(this, UnspecifiedWorkerError); else this.stack = (new Error()).stack; } UnspecifiedWorkerError.prototype = Object.create(Error.prototype);