mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:17:08 +00:00
Filter list of projects to only those readable by user
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
|
||||
const { project} = require('../../../lib/db');
|
||||
const { project } = require('../../../lib/db');
|
||||
|
||||
module.exports = async function (req, res, next) {
|
||||
|
||||
try {
|
||||
res.status(200).send(await project.get());
|
||||
const accessibleProjects = project.organisations.orgFilter(
|
||||
req.user?.organisations,
|
||||
await project.get(),
|
||||
'read'
|
||||
);
|
||||
res.status(200).send(accessibleProjects);
|
||||
next();
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user