Skip to content
Snippets Groups Projects
Commit 859953e0 authored by Viktor Vorobev's avatar Viktor Vorobev
Browse files

Merged in fix-long-requests (pull request #10)

[NRRPLT-0000] quickfix for the "broken" token cache.

* [NRRPLT-0000] quickfix for the "broken" token cache.

Actually, before token is checked, the proxy gets every time user groups from the ebrains services

* Merged development into fix-long-requests

Approved-by: Ugo Albanese
parent fcb28a08
No related branches found
No related tags found
No related merge requests found
......@@ -155,20 +155,23 @@ app.get('/experimentImage/:experiment', (req, res, next) => {
.catch(next);
});
const verifyRunningMode = (req, res, next) => {
isAdmin(req).then(answer => {
adminService.getStatus().then(({ maintenance }) => {
// Non-admin users are deprived of all services in maintenance mode
if (maintenance && !answer) res.status(478).end();
else next();
});
});
};
app.get('/maintenancemode', verifyRunningMode);
// TODO: [NRRPLT-8953] create userGroups cache
// const verifyRunningMode = (req, res, next) => {
// isAdmin(req).then(answer => {
// adminService.getStatus().then(({ maintenance }) => {
// // Non-admin users are deprived of all services in maintenance mode
// if (maintenance && !answer) res.status(478).end();
// else next();
// });
// });
// };
// TODO: [NRRPLT-8953] create userGroups cache
// app.get('/maintenancemode', verifyRunningMode);
app.get('/maintenancemode', (_, res) => res.send({}));
app.get('/experiments', verifyRunningMode);
// TODO: [NRRPLT-8953] create userGroups cache
// app.get('/experiments', verifyRunningMode);
app.get('/experiments', (_req, res, next) => {
proxyRequestHandler
......@@ -227,7 +230,8 @@ const getAuthToken = req => {
return authorization.length > 7 && authorization.substr(7);
};
app.get('/storage/experiments', verifyRunningMode);
// TODO: [NRRPLT-8953] create userGroups cache
// app.get('/storage/experiments', verifyRunningMode);
app.get('/storage/experiments', async (req, res) => {
try {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment