feat(server): add permission request endpoints
This commit is contained in:
@@ -814,6 +814,20 @@ const scenarios: Scenario[] = [
|
||||
object(body.location)
|
||||
array(body.data)
|
||||
}),
|
||||
http.protected
|
||||
.post("/api/session/{sessionID}/permission", "v2.session.permission.create")
|
||||
.seeded((ctx) => ctx.session({ title: "Permission create owner" }))
|
||||
.at((ctx) => ({
|
||||
path: route("/api/session/{sessionID}/permission", { sessionID: ctx.state.id }),
|
||||
headers: ctx.headers(),
|
||||
body: { action: "read", resources: [".env"] },
|
||||
}))
|
||||
.json(200, (body) => {
|
||||
object(body)
|
||||
object(body.data)
|
||||
check(typeof body.data.id === "string", "permission create should return an ID")
|
||||
check(body.data.effect === "ask", "permission create should create a pending request")
|
||||
}),
|
||||
http.protected
|
||||
.get("/api/session/{sessionID}/permission", "v2.session.permission.list")
|
||||
.seeded((ctx) => ctx.session({ title: "Permission list owner" }))
|
||||
@@ -822,6 +836,17 @@ const scenarios: Scenario[] = [
|
||||
headers: ctx.headers(),
|
||||
}))
|
||||
.json(200, data(array)),
|
||||
http.protected
|
||||
.get("/api/session/{sessionID}/permission/{requestID}", "v2.session.permission.get")
|
||||
.seeded((ctx) => ctx.session({ title: "Permission get owner" }))
|
||||
.at((ctx) => ({
|
||||
path: route("/api/session/{sessionID}/permission/{requestID}", {
|
||||
sessionID: ctx.state.id,
|
||||
requestID: "per_httpapi_missing",
|
||||
}),
|
||||
headers: ctx.headers(),
|
||||
}))
|
||||
.json(404, object, "status"),
|
||||
http.protected
|
||||
.get("/api/session/{sessionID}/question", "v2.session.question.list")
|
||||
.seeded((ctx) => ctx.session({ title: "Question list owner" }))
|
||||
|
||||
Reference in New Issue
Block a user