Reapply "feat: open administration to all users"

This reverts commit 9f4db67f4f.
This commit is contained in:
Cauê Faleiros
2026-08-28 12:49:22 -03:00
parent 9f4db67f4f
commit c5edaec7d3
6 changed files with 25 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
const express = require('express');
const { verifySuperAdmin } = require('../auth');
const { verifyToken } = require('../auth');
const {
completeAuthorization,
createAuthorizationUrl,
@@ -13,7 +13,7 @@ const { exportMissingProductionOrderDataCsv, importFinalizedProductionOrderCsv,
const router = express.Router();
router.get('/olist/status', verifySuperAdmin, async (req, res, next) => {
router.get('/olist/status', verifyToken, async (req, res, next) => {
try {
res.json(await getOlistStatus({
runsPage: req.query.runsPage,
@@ -24,7 +24,7 @@ router.get('/olist/status', verifySuperAdmin, async (req, res, next) => {
}
});
router.post('/olist/authorization-url', verifySuperAdmin, async (req, res, next) => {
router.post('/olist/authorization-url', verifyToken, async (req, res, next) => {
try {
res.json({ url: await createAuthorizationUrl() });
} catch (error) {
@@ -32,7 +32,7 @@ router.post('/olist/authorization-url', verifySuperAdmin, async (req, res, next)
}
});
router.post('/olist/sync', verifySuperAdmin, async (req, res, next) => {
router.post('/olist/sync', verifyToken, async (req, res, next) => {
try {
const result = await startOlistSync({
trigger: 'manual',
@@ -44,7 +44,7 @@ router.post('/olist/sync', verifySuperAdmin, async (req, res, next) => {
}
});
router.post('/olist/sync/stop', verifySuperAdmin, async (req, res, next) => {
router.post('/olist/sync/stop', verifyToken, async (req, res, next) => {
try {
res.status(202).json(await requestOlistSyncStop());
} catch (error) {
@@ -52,7 +52,7 @@ router.post('/olist/sync/stop', verifySuperAdmin, async (req, res, next) => {
}
});
router.get('/olist/production-order-imports', verifySuperAdmin, async (req, res, next) => {
router.get('/olist/production-order-imports', verifyToken, async (req, res, next) => {
try {
res.json(await listProductionOrderImportData({
runsPage: req.query.runsPage,
@@ -63,7 +63,7 @@ router.get('/olist/production-order-imports', verifySuperAdmin, async (req, res,
}
});
router.get('/olist/production-order-imports/pending-csv', verifySuperAdmin, async (req, res, next) => {
router.get('/olist/production-order-imports/pending-csv', verifyToken, async (req, res, next) => {
try {
res.json(await exportMissingProductionOrderDataCsv());
} catch (error) {
@@ -71,7 +71,7 @@ router.get('/olist/production-order-imports/pending-csv', verifySuperAdmin, asyn
}
});
router.post('/olist/production-order-imports', verifySuperAdmin, async (req, res, next) => {
router.post('/olist/production-order-imports', verifyToken, async (req, res, next) => {
try {
res.status(201).json(await importFinalizedProductionOrderCsv(req.body || {}));
} catch (error) {
@@ -79,7 +79,7 @@ router.post('/olist/production-order-imports', verifySuperAdmin, async (req, res
}
});
router.get('/olist/runs/:runId', verifySuperAdmin, async (req, res, next) => {
router.get('/olist/runs/:runId', verifyToken, async (req, res, next) => {
try {
res.json(await getOlistRunDetails(req.params.runId, {
eventsPage: req.query.eventsPage,