first commit
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s

This commit is contained in:
John
2026-09-23 17:31:02 +05:30
commit 69b4e68baf
51657 changed files with 3864077 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
'use strict';
// routes/mailLogs.js — read-only Mail Log viewer API. Access: full Admin and
// System Admin roles always; any other user must be granted the 'mail_log'
// module. Mirrors routes/audit.js exactly.
const express = require('express');
const router = express.Router();
const { verifyToken } = require('../middleware/auth');
const store = require('../services/mailLogStore');
async function requireMailLogView(req, res, next) {
const u = req.user || {};
if (u.role === 'admin' || u.role === 'system_admin') return next();
try {
const full = await require('../services/hanaUsers').findById(u.id);
const mods = Array.isArray(full && full.modules) ? full.modules : [];
if (mods.includes('mail_log')) return next();
} catch (_e) {}
return res.status(403).json({ success: false, message: 'You do not have access to the Mail Log.' });
}
router.get('/', verifyToken, requireMailLogView, async (req, res) => {
try {
const { data, total } = await store.list(req.query);
res.json({ success: true, data, total });
} catch (err) { res.status(500).json({ success: false, message: err.message }); }
});
module.exports = router;