Blacklist functionality
Some API improvements
This commit is contained in:
parent
c343e4efd3
commit
9203b5cee7
40 changed files with 726 additions and 398 deletions
|
@ -18,7 +18,7 @@ router.postAsync('/account', passport.loggedIn, passport.csrfProtection, async (
|
|||
const data = req.body;
|
||||
data.id = req.user.id;
|
||||
|
||||
await users.updateWithConsistencyCheck(req.body, true);
|
||||
await users.updateWithConsistencyCheck(contextHelpers.getAdminContext(), req.body, true);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
|
@ -26,7 +26,7 @@ router.postAsync('/account-validate', passport.loggedIn, passport.csrfProtection
|
|||
const data = req.body;
|
||||
data.id = req.user.id;
|
||||
|
||||
return res.json(await users.serverValidate(req.context, data, true));
|
||||
return res.json(await users.serverValidate(contextHelpers.getAdminContext(), data, true));
|
||||
});
|
||||
|
||||
router.getAsync('/access-token', passport.loggedIn, async (req, res) => {
|
||||
|
|
27
routes/rest/blacklist.js
Normal file
27
routes/rest/blacklist.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
const passport = require('../../lib/passport');
|
||||
const blacklist = require('../../models/blacklist');
|
||||
|
||||
const router = require('../../lib/router-async').create();
|
||||
|
||||
|
||||
router.postAsync('/blacklist-table', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await blacklist.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/blacklist', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await blacklist.add(req.context, req.body.email);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.deleteAsync('/blacklist/:email', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
await blacklist.remove(req.context, req.params.email);
|
||||
return res.json();
|
||||
});
|
||||
|
||||
router.postAsync('/blacklist-validate', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await blacklist.serverValidate(req.context, req.body));
|
||||
});
|
||||
|
||||
module.exports = router;
|
|
@ -40,9 +40,4 @@ router.getAsync('/report-template-user-fields/:reportTemplateId', passport.logge
|
|||
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