fixing toasts not showing on certain pages / adding statement about ai 🤖

This commit is contained in:
orangecoding
2026-04-27 15:58:41 +02:00
parent f30ec4645c
commit 8a7b14c079
10 changed files with 168 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ import restana from 'restana';
import * as userStorage from '../../services/storage/userStorage.js';
import * as jobStorage from '../../services/storage/jobStorage.js';
import { getSettings } from '../../services/storage/settingsStorage.js';
import { isAdmin as isAdminUser } from '../security.js';
const service = restana();
const userRouter = service.newRouter();
function checkIfAnyAdminAfterRemovingUser(userIdToBeRemoved, allUser) {
@@ -29,7 +30,7 @@ userRouter.get('/:userId', async (req, res) => {
});
userRouter.delete('/', async (req, res) => {
const settings = await getSettings();
if (settings.demoMode) {
if (settings.demoMode && !isAdminUser(req)) {
res.send(new Error('In demo mode, it is not allowed to remove user.'));
return;
}
@@ -51,7 +52,7 @@ userRouter.delete('/', async (req, res) => {
});
userRouter.post('/', async (req, res) => {
const settings = await getSettings();
if (settings.demoMode) {
if (settings.demoMode && !isAdminUser(req)) {
res.send(new Error('In demo mode, it is not allowed to change or add user.'));
return;
}