Test cases based on frontend.
This commit is contained in:
parent
c40e4a7288
commit
1f9c33c53a
|
@ -121,6 +121,34 @@ describe("/roles", () => {
|
|||
{ status: 400, body: { message: LOOP_ERROR } }
|
||||
)
|
||||
})
|
||||
|
||||
it("frontend example - should deny", async () => {
|
||||
const id1 = "cb27c4ec9415042f4800411adb346fb7c",
|
||||
id2 = "cbc72a9d61ab64d49b31d90d1df4c1fdb"
|
||||
const role1 = await config.api.roles.save({
|
||||
_id: id1,
|
||||
name: id1,
|
||||
permissions: {},
|
||||
permissionId: "write",
|
||||
version: "name",
|
||||
inherits: ["POWER"],
|
||||
})
|
||||
await config.api.roles.save({
|
||||
_id: id2,
|
||||
permissions: {},
|
||||
name: id2,
|
||||
permissionId: "write",
|
||||
version: "name",
|
||||
inherits: [id1],
|
||||
})
|
||||
await config.api.roles.save(
|
||||
{
|
||||
...role1,
|
||||
inherits: [BUILTIN_ROLE_IDS.POWER, id2],
|
||||
},
|
||||
{ status: 400, body: { message: LOOP_ERROR } }
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("fetch", () => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Role, RoleUIMetadata } from "../../documents"
|
||||
import { PermissionLevel } from "../../sdk"
|
||||
|
||||
export interface SaveRoleRequest {
|
||||
_id?: string
|
||||
|
@ -6,6 +7,7 @@ export interface SaveRoleRequest {
|
|||
name: string
|
||||
inherits?: string | string[]
|
||||
permissionId: string
|
||||
permissions?: Record<string, PermissionLevel[]>
|
||||
version?: string
|
||||
uiMetadata?: RoleUIMetadata
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue