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||'[]')])];
|
||||
|
||||
2
build.sh
2
build.sh
@@ -13,7 +13,7 @@
|
||||
# ─────────────────────────────────────────────────────────────
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="${1:-0.12.12}"
|
||||
VERSION="${1:-0.12.13}"
|
||||
ACTION="${2:-}"
|
||||
REGISTRY="${REGISTRY:-}"
|
||||
IMAGE_NAME="rosterchirp"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rosterchirp-frontend",
|
||||
"version": "0.12.12",
|
||||
"version": "0.12.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1364,10 +1364,11 @@ export default function SchedulePage({ isToolManager, isMobile, onProfile, onHel
|
||||
const createRef = useRef(null);
|
||||
|
||||
const load = useCallback(() => {
|
||||
Promise.all([api.getEvents(), api.getEventTypes(), api.getUserGroups()])
|
||||
const ugPromise = isToolManager ? api.getUserGroups() : Promise.resolve({ groups: [] });
|
||||
Promise.all([api.getEvents(), api.getEventTypes(), ugPromise])
|
||||
.then(([ev,et,ug]) => { setEvents(ev.events||[]); setEventTypes(et.eventTypes||[]); setUserGroups(ug.groups||[]); setLoading(false); })
|
||||
.catch(() => setLoading(false));
|
||||
}, []);
|
||||
}, [isToolManager]);
|
||||
|
||||
useEffect(() => { load(); }, [load]);
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ export default function Chat() {
|
||||
...(groups.privateGroups || [])
|
||||
].find(g => g.id === activeGroupId);
|
||||
|
||||
const isToolManager = user?.role === 'admin' || (features.teamToolManagers || []).some(gid => (features.userGroupMemberships || []).includes(gid));
|
||||
const isToolManager = user?.role === 'admin' || user?.role === 'manager' || (features.teamToolManagers || []).some(gid => (features.userGroupMemberships || []).includes(gid));
|
||||
|
||||
// Unread indicators for burger icon and nav drawer
|
||||
const allGroupsFlat = [...(groups.publicGroups || []), ...(groups.privateGroups || [])];
|
||||
|
||||
Reference in New Issue
Block a user