feat: Enhance admin access and UI for privileged users
Grant 'poweruser' role access to administrative settings and sections. Update UI to reflect elevated privileges and adjust default tab navigation for these users. Modify server-side access control to include 'poweruser' alongside 'admin' for privileged routes.
This commit is contained in:
@@ -89,11 +89,12 @@ const authenticateToken = (req, res, next) => {
|
||||
};
|
||||
|
||||
const requireAdmin = (req, res, next) => {
|
||||
if (req.user && req.user.role === 'admin') {
|
||||
// Allow both 'admin' and 'poweruser' to access administrative routes
|
||||
if (req.user && (req.user.role === 'admin' || req.user.role === 'poweruser')) {
|
||||
next();
|
||||
} else {
|
||||
console.warn(`Access denied for user ${req.user?.email} with role ${req.user?.role}`);
|
||||
res.status(403).json({ message: 'Access denied: Admins only' });
|
||||
res.status(403).json({ message: 'Access denied: Privileged users only' });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user