tests passing...
This commit is contained in:
parent
c2d444f808
commit
a782e124e6
|
@ -1 +1 @@
|
||||||
Subproject commit 29318b29d35ac8d8bfb137a5e739a308e01c1829
|
Subproject commit b372ad7403fa12f92670ef38e7576bc5795006e9
|
|
@ -53,7 +53,7 @@ const deleteFolder = root => async (path) =>
|
||||||
|
|
||||||
const readableFileStream = root => async path =>
|
const readableFileStream = root => async path =>
|
||||||
fs.createReadStream(
|
fs.createReadStream(
|
||||||
join(root, path), "utf8"
|
join(root, path)
|
||||||
);
|
);
|
||||||
|
|
||||||
const writableFileStream = root => path =>
|
const writableFileStream = root => path =>
|
||||||
|
|
|
@ -69,7 +69,11 @@ module.exports = (config, app) => {
|
||||||
pathParts[1],
|
pathParts[1],
|
||||||
ctx.sessionId);
|
ctx.sessionId);
|
||||||
|
|
||||||
|
if(ctx.instance === null) {
|
||||||
|
ctx.response.status = StatusCodes.UNAUTHORIZED;
|
||||||
|
} else {
|
||||||
await next();
|
await next();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.post("/:appname/api/changeMyPassword", async (ctx) => {
|
.post("/:appname/api/changeMyPassword", async (ctx) => {
|
||||||
await ctx.instance.authApi.changeMyPassword(
|
await ctx.instance.authApi.changeMyPassword(
|
||||||
|
|
|
@ -88,7 +88,7 @@ module.exports = (app) => {
|
||||||
|
|
||||||
await app.get("/_master/api/users/")
|
await app.get("/_master/api/users/")
|
||||||
.set("cookie", newUserCookie)
|
.set("cookie", newUserCookie)
|
||||||
.expect(statusCodes.FORBIDDEN);
|
.expect(statusCodes.UNAUTHORIZED);
|
||||||
|
|
||||||
await app.post("/_master/api/authenticate", {
|
await app.post("/_master/api/authenticate", {
|
||||||
username: testUserName,
|
username: testUserName,
|
||||||
|
|
|
@ -115,15 +115,23 @@ module.exports = async (config) => {
|
||||||
const getInstanceApiForSession = async (appname, sessionId) => {
|
const getInstanceApiForSession = async (appname, sessionId) => {
|
||||||
if(isMaster(appname)) {
|
if(isMaster(appname)) {
|
||||||
const customId = bb.recordApi.customId("mastersession", sessionId);
|
const customId = bb.recordApi.customId("mastersession", sessionId);
|
||||||
|
try {
|
||||||
const session = await bb.recordApi.load(`/sessions/${customId}`);
|
const session = await bb.recordApi.load(`/sessions/${customId}`);
|
||||||
return await getApisForSession(masterDatastore, session);
|
return await getApisForSession(masterDatastore, session);
|
||||||
|
} catch(_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const app = await getApplication(appname);
|
const app = await getApplication(appname);
|
||||||
const customId = bb.recordApi.customId("session", sessionId);
|
const customId = bb.recordApi.customId("session", sessionId);
|
||||||
|
try {
|
||||||
const session = await bb.recordApi.load(`/applications/${app.id}/sessions/${customId}`);
|
const session = await bb.recordApi.load(`/applications/${app.id}/sessions/${customId}`);
|
||||||
const instanceDatastore = getInstanceDatastore(session.instanceDatastoreConfig)
|
const instanceDatastore = getInstanceDatastore(session.instanceDatastoreConfig)
|
||||||
return await getApisForSession(instanceDatastore, session);
|
return await getApisForSession(instanceDatastore, session);
|
||||||
|
} catch(_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,7 +170,8 @@ module.exports = async (config) => {
|
||||||
"/mastersessions_by_user",
|
"/mastersessions_by_user",
|
||||||
{
|
{
|
||||||
rangeStartParams:{username},
|
rangeStartParams:{username},
|
||||||
rangeEndParams:{username}
|
rangeEndParams:{username},
|
||||||
|
searchPhrase:`username:${username}`
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue