mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
* Updated userItemsNotEnough string * Added a variable to be passed to the deleteSocialAccountText string. This variable name is `magic_word` and is set as DELETE where used * modified incorrectDeletePhrase to use a variable rather than translatable string for the word DELETE. Updated the DELETE-user test and the user api * Changed noSudoAccess from translatable string to static * Changed enterprisePlansEmailSubject from a translatable string to a static string within groupPlans.vue * Fixed test problems with translation fixes * Added no sudo access string to api messages * changed plain string to apiMessage for no sudo access messages
25 lines
479 B
JavaScript
25 lines
479 B
JavaScript
import {
|
|
NotAuthorized,
|
|
} from '../libs/errors';
|
|
import apiMessages from '../libs/apiMessages';
|
|
|
|
export function ensureAdmin (req, res, next) {
|
|
let user = res.locals.user;
|
|
|
|
if (!user.contributor.admin) {
|
|
return next(new NotAuthorized(res.t('noAdminAccess')));
|
|
}
|
|
|
|
next();
|
|
}
|
|
|
|
export function ensureSudo (req, res, next) {
|
|
let user = res.locals.user;
|
|
|
|
if (!user.contributor.sudo) {
|
|
return next(new NotAuthorized(apiMessages('noSudoAccess')));
|
|
}
|
|
|
|
next();
|
|
}
|