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:
parent
0cd05a4adf
commit
9c32f278b7
|
@ -208,11 +208,6 @@ export function getAutomationId(): string | undefined {
|
||||||
return context?.automationId
|
return context?.automationId
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasAppId(): boolean {
|
|
||||||
const appId = getAppId()
|
|
||||||
return !!appId
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getAppId(): string | undefined {
|
export function getAppId(): string | undefined {
|
||||||
const context = Context.get()
|
const context = Context.get()
|
||||||
const foundId = context?.appId
|
const foundId = context?.appId
|
||||||
|
|
|
@ -84,16 +84,13 @@ export async function allowsExplicitPermissions(resourceId: string) {
|
||||||
export async function getResourcePerms(
|
export async function getResourcePerms(
|
||||||
resourceId: string
|
resourceId: string
|
||||||
): Promise<ResourcePermissions> {
|
): Promise<ResourcePermissions> {
|
||||||
let rolesList: Role[] = []
|
const db = context.getAppDB()
|
||||||
if (context.hasAppId()) {
|
const body = await db.allDocs(
|
||||||
const db = context.getAppDB()
|
getRoleParams(null, {
|
||||||
const body = await db.allDocs(
|
include_docs: true,
|
||||||
getRoleParams(null, {
|
})
|
||||||
include_docs: true,
|
)
|
||||||
})
|
const rolesList = body.rows.map<Role>(row => row.doc)
|
||||||
)
|
|
||||||
rolesList = body.rows.map<Role>(row => row.doc)
|
|
||||||
}
|
|
||||||
let permissions: ResourcePermissions = {}
|
let permissions: ResourcePermissions = {}
|
||||||
|
|
||||||
const permsToInherit = await getInheritablePermissions(resourceId)
|
const permsToInherit = await getInheritablePermissions(resourceId)
|
||||||
|
@ -131,7 +128,8 @@ export async function getResourcePerms(
|
||||||
p[level] = { role, type: PermissionSource.BASE }
|
p[level] = { role, type: PermissionSource.BASE }
|
||||||
return p
|
return p
|
||||||
}, {})
|
}, {})
|
||||||
return Object.assign(basePermissions, permissions)
|
const result = Object.assign(basePermissions, permissions)
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDependantResources(
|
export async function getDependantResources(
|
||||||
|
|
Loading…
Reference in New Issue