v0.12.13 user manager permissions + member event calendar
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rosterchirp-backend",
|
||||
"version": "0.12.12",
|
||||
"version": "0.12.13",
|
||||
"description": "RosterChirp backend server",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -39,7 +39,7 @@ function adminMiddleware(req, res, next) {
|
||||
}
|
||||
|
||||
async function teamManagerMiddleware(req, res, next) {
|
||||
if (req.user?.role === 'admin') return next();
|
||||
if (req.user?.role === 'admin' || req.user?.role === 'manager') return next();
|
||||
try {
|
||||
const tmSetting = await queryOne(req.schema,
|
||||
"SELECT value FROM settings WHERE key = 'team_tool_managers'"
|
||||
|
||||
@@ -54,7 +54,7 @@ async function postEventNotification(schema, eventId, actorId, isUpdate) {
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
async function isToolManagerFn(schema, user) {
|
||||
if (user.role === 'admin') return true;
|
||||
if (user.role === 'admin' || user.role === 'manager') return true;
|
||||
const tm = await queryOne(schema, "SELECT value FROM settings WHERE key='team_tool_managers'");
|
||||
const gm = await queryOne(schema, "SELECT value FROM settings WHERE key='team_group_managers'");
|
||||
const groupIds = [...new Set([...JSON.parse(tm?.value||'[]'), ...JSON.parse(gm?.value||'[]')])];
|
||||
|
||||
Reference in New Issue
Block a user