Skip to content

Commit

Permalink
Used standard exported
Browse files Browse the repository at this point in the history
  • Loading branch information
rorylshanks committed Mar 22, 2024
1 parent d5af731 commit ea47ebe
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/adminpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import idp from './idp.js';
import errorpages from '../util/errorpage.js'
import { decodeJWT, createJWT } from '../util/jwt.js';
import log from '../util/logging.js'
import authz from './authz.js'

var redirectBasePath = getRedirectBasepath()

Expand All @@ -26,7 +27,7 @@ async function verifyAdminJwt(req, res, next) {
return
}
var allowedGroups = getConfig().admin.allowed_groups
var foundGroups = await checkUserGroupMembership(decodedJwt, allowedGroups)
var foundGroups = await authz.checkUserGroupMembership(decodedJwt, allowedGroups)
if (foundGroups.length > 0) {
next()
} else {
Expand Down Expand Up @@ -103,12 +104,6 @@ async function killSession(req, res) {
res.redirect(redirectBasePath + '/admin/sessions/')
}

async function checkUserGroupMembership(user, groups) {
// FIXME Change this to be a set in memory as part of the idpUpdate
let set = new Set(user.groups);
return groups.filter(item => set.has(item));
}

export default {
renderSessionsPage,
killSession,
Expand Down

0 comments on commit ea47ebe

Please sign in to comment.