1
0
Fork 0
mirror of synced 2024-09-30 00:57:16 +13:00

Fixing minor bug with permission add.

This commit is contained in:
mike12345567 2021-02-09 13:14:23 +00:00
parent c8ef404560
commit 2103378e5c
3 changed files with 7 additions and 5 deletions

View file

@ -71,10 +71,11 @@ async function updatePermissionOnRole(
} }
const response = await db.bulkDocs(docUpdates) const response = await db.bulkDocs(docUpdates)
return response.map(resp => ({ return response.map(resp => {
...resp, resp._id = getExternalRoleID(resp.id)
_id: getExternalRoleID(resp._id), delete resp.id
})) return resp
})
} }
exports.fetchBuiltin = function(ctx) { exports.fetchBuiltin = function(ctx) {

View file

@ -47,6 +47,7 @@ router.use(async (ctx, next) => {
message: err.message, message: err.message,
status: ctx.status, status: ctx.status,
} }
console.trace(err)
} }
}) })

View file

@ -48,7 +48,7 @@ describe("/permission", () => {
describe("test", () => { describe("test", () => {
it("should be able to add permission to a role for the table", async () => { it("should be able to add permission to a role for the table", async () => {
expect(perms.length).toEqual(1) expect(perms.length).toEqual(1)
expect(perms[0].id).toEqual(`${STD_ROLE_ID}`) expect(perms[0]._id).toEqual(`${STD_ROLE_ID}`)
}) })
it("should get the resource permissions", async () => { it("should get the resource permissions", async () => {