mirror of
https://github.com/freedbygrace/ActiveDirectoryManager.git
synced 2026-08-29 03:57:05 +00:00
Improve LDAP query builder page and enhance API security.
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/1a0cae6d-1419-4e33-945a-4f87737719de.jpg
This commit is contained in:
@@ -13,9 +13,14 @@ import { InsertLdapQuery, LdapQuery, InsertLdapQueryVersion } from "@shared/sche
|
||||
// Use middleware to check permissions
|
||||
function hasPermission(permission: string) {
|
||||
return (req: any, res: any, next: any) => {
|
||||
// For now, we'll just allow all requests through
|
||||
// In a real implementation, this would check the user's permissions
|
||||
return next();
|
||||
// Check if the user is authenticated via passport session or has a valid API token
|
||||
if (req.user || req.headers.authorization) {
|
||||
// In a real implementation, this would check the user's permissions against the required permission
|
||||
return next();
|
||||
}
|
||||
|
||||
// If not authenticated, return 401 Unauthorized
|
||||
return res.status(401).json({ error: "Unauthorized" });
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user