rights system
This commit is contained in:
@@ -76,6 +76,35 @@ class PermissionController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT /api/admin/permissions/bulk
|
||||
* Bulk-update permissions for multiple groups in one request.
|
||||
* Body: { updates: [{ group: string, permissions: string[] }] }
|
||||
*/
|
||||
async setBulkPermissions(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
const { updates } = req.body;
|
||||
|
||||
if (!Array.isArray(updates)) {
|
||||
res.status(400).json({ success: false, message: 'updates must be an array' });
|
||||
return;
|
||||
}
|
||||
|
||||
for (const u of updates) {
|
||||
if (typeof u.group !== 'string' || !Array.isArray(u.permissions)) {
|
||||
res.status(400).json({ success: false, message: 'Each update must have group (string) and permissions (array)' });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
await permissionService.setMultipleGroupPermissions(updates, req.user!.id);
|
||||
res.json({ success: true, message: 'Berechtigungen aktualisiert' });
|
||||
} catch (error) {
|
||||
logger.error('Failed to set bulk permissions', { error });
|
||||
res.status(500).json({ success: false, message: 'Fehler beim Speichern der Berechtigungen' });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/admin/permissions/groups
|
||||
* Returns all known Authentik groups from the permission table.
|
||||
|
||||
Reference in New Issue
Block a user