Revert "Quick fix issue integration tests have displayed, retrieving users through the public API was broken due to a lack of app ID in context."

This reverts commit 0cd05a4adf.
This commit is contained in:
mike12345567 2023-09-06 10:09:45 +01:00
parent 0cd05a4adf
commit 9c32f278b7
2 changed files with 9 additions and 16 deletions

View File

@ -208,11 +208,6 @@ export function getAutomationId(): string | undefined {
return context?.automationId
}
export function hasAppId(): boolean {
const appId = getAppId()
return !!appId
}
export function getAppId(): string | undefined {
const context = Context.get()
const foundId = context?.appId

View File

@ -84,16 +84,13 @@ export async function allowsExplicitPermissions(resourceId: string) {
export async function getResourcePerms(
resourceId: string
): Promise<ResourcePermissions> {
let rolesList: Role[] = []
if (context.hasAppId()) {
const db = context.getAppDB()
const body = await db.allDocs(
getRoleParams(null, {
include_docs: true,
})
)
rolesList = body.rows.map<Role>(row => row.doc)
}
const db = context.getAppDB()
const body = await db.allDocs(
getRoleParams(null, {
include_docs: true,
})
)
const rolesList = body.rows.map<Role>(row => row.doc)
let permissions: ResourcePermissions = {}
const permsToInherit = await getInheritablePermissions(resourceId)
@ -131,7 +128,8 @@ export async function getResourcePerms(
p[level] = { role, type: PermissionSource.BASE }
return p
}, {})
return Object.assign(basePermissions, permissions)
const result = Object.assign(basePermissions, permissions)
return result
}
export async function getDependantResources(