WiP on permissions
Doesn't run. This commit is just to backup the changes.
This commit is contained in:
parent
5df444f641
commit
89c9615592
37 changed files with 913 additions and 366 deletions
|
@ -8,13 +8,13 @@ const router = require('../../lib/router-async').create();
|
|||
|
||||
|
||||
router.getAsync('/report-templates/:reportTemplateId', passport.loggedIn, async (req, res) => {
|
||||
const reportTemplate = await reportTemplates.getById(req.params.reportTemplateId);
|
||||
const reportTemplate = await reportTemplates.getById(req.context, req.params.reportTemplateId);
|
||||
reportTemplate.hash = reportTemplates.hash(reportTemplate);
|
||||
return res.json(reportTemplate);
|
||||
});
|
||||
|
||||
router.postAsync('/report-templates', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await reportTemplates.create(req.body);
|
||||
await reportTemplates.create(req.context, req.body);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
|
@ -22,23 +22,27 @@ router.putAsync('/report-templates/:reportTemplateId', passport.loggedIn, passpo
|
|||
const reportTemplate = req.body;
|
||||
reportTemplate.id = parseInt(req.params.reportTemplateId);
|
||||
|
||||
await reportTemplates.updateWithConsistencyCheck(reportTemplate);
|
||||
await reportTemplates.updateWithConsistencyCheck(req.context, reportTemplate);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.deleteAsync('/report-templates/:reportTemplateId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await reportTemplates.remove(req.params.reportTemplateId);
|
||||
await reportTemplates.remove(req.context, req.params.reportTemplateId);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.postAsync('/report-templates-table', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await reportTemplates.listDTAjax(req.body));
|
||||
return res.json(await reportTemplates.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.getAsync('/report-template-user-fields/:reportTemplateId', passport.loggedIn, async (req, res) => {
|
||||
const userFields = await reportTemplates.getUserFieldsById(req.params.reportTemplateId);
|
||||
const userFields = await reportTemplates.getUserFieldsById(req.context, req.params.reportTemplateId);
|
||||
return res.json(userFields);
|
||||
});
|
||||
|
||||
router.getAsync('/report-templates-create-permitted', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await shares.checkTypePermission(req.context, 'namespace', 'createReportTemplate'));
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
Loading…
Add table
Add a link
Reference in a new issue