Add cross-app super admin group; rename Executive page to Overview

- app_super_admin is a new cross-app LDAP group (also recognized by proxy
  and jump-host) that grants full admin here regardless of app_sso_admin
  membership: bypassed centrally in utils/permission.js's byGroup, folded
  into GET /api/user/me's isAdmin flag, and added to nav/forceLogin gates
  alongside app_sso_admin.
- Renamed the Executive page to Overview (route, view, API path
  /api/metrics/overview, nav label, docs), keeping /executive as a 301
  redirect alongside the existing /admin, /notifications, /dashboard
  legacy redirects.
This commit is contained in:
2026-07-30 11:56:58 -04:00
parent 6c71c91ff6
commit e9b808d1c2
11 changed files with 33 additions and 22 deletions
+2 -2
View File
@@ -3,8 +3,8 @@ const router = require('express').Router();
const permission = require('../utils/permission');
const metrics = require('../utils/metrics');
// /api/metrics/executive
router.get('/executive', async (req, res, next) => {
// /api/metrics/overview
router.get('/overview', async (req, res, next) => {
try {
await permission.byGroup(req.user, ['app_sso_admin']);
+6 -5
View File
@@ -48,13 +48,14 @@ router.get('/tos', async function(req, res, next) {
// Admin dashboard (stats + recent/inactive users) and Notifications
// (broadcast + history) merged into one page.
router.get('/executive', function(req, res) {
res.render('executive', {...values});
router.get('/overview', function(req, res) {
res.render('overview', {...values});
});
router.get('/admin', (req, res) => res.redirect(301, '/executive'));
router.get('/notifications', (req, res) => res.redirect(301, '/executive'));
router.get('/dashboard', (req, res) => res.redirect(301, '/executive'));
router.get('/admin', (req, res) => res.redirect(301, '/overview'));
router.get('/notifications', (req, res) => res.redirect(301, '/overview'));
router.get('/dashboard', (req, res) => res.redirect(301, '/overview'));
router.get('/executive', (req, res) => res.redirect(301, '/overview'));
router.get('/directory', function(req, res) {
res.render('directory', {...values});
+3 -2
View File
@@ -78,11 +78,12 @@ router.get('/me', async function(req, res, next){
// The shared client framework gates the UI on a single effective-rights
// flag (the OIDC-client apps send the same key). Here "admin" means
// membership in app_sso_admin; group-level gating still reads memberOf.
// membership in app_sso_admin or the cross-app app_super_admin group;
// group-level gating still reads memberOf.
const groups = (user.memberOf || []).map(function(dn){
return String(dn).split(',')[0].replace(/^cn=/i, '');
});
user.isAdmin = groups.includes('app_sso_admin');
user.isAdmin = groups.includes('app_sso_admin') || groups.includes(permission.SUPER_ADMIN_GROUP);
return res.json(user);
}catch(error){
+10 -1
View File
@@ -2,7 +2,16 @@
const {Group} = require('../models/group_ldap');
const SUPER_ADMIN_GROUP = 'app_super_admin';
let byGroup = async function(user, groups, ownerOf){
try{
let superAdmin = await Group.get(SUPER_ADMIN_GROUP);
if(superAdmin.member.includes(user.dn)) return true
}catch(error){
// group not found, continue checking
}
for(let group of groups){
try{
group = await Group.get(group);
@@ -28,4 +37,4 @@ let byGroup = async function(user, groups, ownerOf){
throw error;
}
module.exports = {byGroup};
module.exports = {byGroup, SUPER_ADMIN_GROUP};
+4 -4
View File
@@ -38,9 +38,9 @@ module.exports = {
// app-base.js, which reveals .group-required-<cn> for each group the user is
// in (plus the synthetic `admin` group when user/me reports isAdmin).
nav: [
{href: '/users', icon: 'fa-solid fa-users', label: 'Users', groups: ['app_sso_admin']},
{href: '/groups', icon: 'fa-solid fa-users-viewfinder', label: 'Groups', groups: ['app_sso_admin']},
{href: '/directory', icon: 'fa-solid fa-server', label: 'Directory', groups: ['app_sso_admin', 'app_sso_directory_admin']},
{href: '/executive', icon: 'fa-solid fa-gauge-high', label: 'Executive', groups: ['app_sso_admin']},
{href: '/users', icon: 'fa-solid fa-users', label: 'Users', groups: ['app_sso_admin', 'admin']},
{href: '/groups', icon: 'fa-solid fa-users-viewfinder', label: 'Groups', groups: ['app_sso_admin', 'admin']},
{href: '/directory', icon: 'fa-solid fa-server', label: 'Directory', groups: ['app_sso_admin', 'app_sso_directory_admin', 'admin']},
{href: '/overview', icon: 'fa-solid fa-gauge-high', label: 'Overview', groups: ['app_sso_admin', 'admin']},
],
};
+1 -1
View File
@@ -73,7 +73,7 @@
</div>
<script>
app.auth.forceLogin(['app_sso_admin', 'app_sso_directory_admin']);
app.auth.forceLogin(['app_sso_admin', 'app_sso_directory_admin', 'admin']);
// --- Resource modal tab content, built once. Populated via .val() in
// openAddModal/openEditModal AFTER app.modal.open() has (re)built the
+1 -1
View File
@@ -140,7 +140,7 @@
}
}
app.auth.forceLogin('app_sso_admin');
app.auth.forceLogin(['app_sso_admin', 'admin']);
$(document).ready(async function(){
userlist = (await app.user.list()).results;
@@ -1,7 +1,7 @@
<%- include('top') %>
<script type="text/javascript">
app.auth.forceLogin('app_sso_admin');
app.auth.forceLogin(['app_sso_admin', 'admin']);
// ── Overview (stats, recent signups, inactive users) ────────────────────
async function loadDashboard() {
@@ -46,7 +46,7 @@
async function loadMetrics() {
try {
const data = await app.api.get('metrics/executive');
const data = await app.api.get('metrics/overview');
if (data && data.results) {
const renderList = (items, id) => {
const el = document.getElementById(id);
@@ -213,7 +213,7 @@
<div class="container mt-4">
<div class="row mb-3">
<div class="col-12">
<h4 class="mb-0"><i class="fa-solid fa-gauge-high"></i> Executive Dashboard</h4>
<h4 class="mb-0"><i class="fa-solid fa-gauge-high"></i> Overview</h4>
</div>
</div>
+1 -1
View File
@@ -223,7 +223,7 @@
}
(async function(){
await app.auth.forceLogin('app_sso_admin');
await app.auth.forceLogin(['app_sso_admin', 'admin']);
$(document).ready(function(){
renderUsers();