Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Projects

Several teams can share one instance without stepping on each other: the payments team edits its mocks and tests, and sees the rest read-only or not at all. A project groups mocks, saved tests, checkpoints and storyboards (a mock's portal item follows its mock), and a user's roles in a project apply to its resources on top of their instance roles.

  • The union rule. A permission on a resource of a project is the union of the user's instance roles and their roles in that project. An editor of payments with the instance role viewer edits payments' mocks and reads everything else; with no instance role at all, they see payments only.
  • Without a project a resource is the instance's, as everything was before projects: only instance roles reach it. A user with instance roles only sees and does exactly what they did before.
  • Instance-wide things (settings, egress, users and roles, source control, captured traffic of the whole instance, the harness, gateway scenarios, schedules) need instance roles. A user with a role in a project also holds instance.read, so the console's status and catalogue load.
  • Another project's resource a user may not read answers 404, as other visitors' mocks do, and every list leaves it out. Nor do project names leak: naming a project that does not exist answers like naming one the caller may not use (403 permission_required; only a caller who holds the permission on the whole instance hears 400 unknown_project), and a checkpoint's restore says a mock is "now in another project" without naming it. GET /_rustybin/projects lists a project's resources (mock, test and checkpoint names) only to who reads them there (mocks.read, tests.read): users.read sees the project and its members, not its contents. The mocks' load errors (which name any mock) go to who holds mocks.write on the whole instance only.
  • Moving a mock or a saved test to another project needs the write permission (mocks.write, tests.write) in both.
  • The guard rails stay instance-wide: a project's admin role never counts as an admin of the instance, so the last enabled admin stays one.

At most 100 projects. A project's name follows the mock name rules (lower case letters, digits and -) and is never instance, which stands for the instance's resources in ?project=instance and move_to=instance.

Create a project and add people

PUT /_rustybin/projects/{name} (users.manage) creates the project or changes it:

PUT {{password_url}}/_rustybin/projects/docs-payments
Authorization: Bearer {{admin}}
Content-Type: application/json
{ "description": "The payments team" }
HTTP 201
[Asserts]
jsonpath "$.name" == "docs-payments"
jsonpath "$.created" == true
jsonpath "$.members" count == 0

members ([{user, roles}], a user by id or sign-in name) replaces the member list. The rules of users and roles hold in a project too: nobody changes their own roles, and a caller gives or takes only roles whose permissions it holds there. An invitation may give roles in projects (projects); with some, the instance roles may be left empty:

# A user with roles in the project only (no instance role): they see it
# and nothing else.
POST {{password_url}}/_rustybin/users
Authorization: Bearer {{admin}}
Content-Type: application/json
{ "name": "docs-pia", "roles": [], "projects": [{ "project": "docs-payments", "roles": ["editor"] }] }
HTTP 201
[Captures]
invitation: jsonpath "$.invitation.token"
[Asserts]
jsonpath "$.user.projects[0].project" == "docs-payments"
jsonpath "$.user.projects[0].roles[0]" == "editor"

The session says what the user holds where:

GET {{password_url}}/_rustybin/session
Authorization: Bearer {{pia}}
HTTP 200
[Asserts]
jsonpath "$.roles" count == 0
jsonpath "$.permissions" includes "instance.read"
jsonpath "$.permissions" not includes "mocks.write"
jsonpath "$.projects[0].project" == "docs-payments"
jsonpath "$.projects[0].permissions" includes "mocks.write"

Resources in a project

A mock, a saved test or a checkpoint names its project with project when it is created (POST /_rustybin/mocks, POST /_rustybin/tests, PUT /_rustybin/tests/{name}, POST /_rustybin/checkpoints). A caller without the instance-wide permission who works in exactly one project and names none creates in that project:

# Her mock goes to her one project (or name it: "project": "docs-payments").
POST {{password_url}}/_rustybin/mocks
Authorization: Bearer {{pia}}
Content-Type: application/json
{ "name": "docs-pay-api", "spec": { "openapi": "3.0.3", "info": { "title": "Payments", "version": "1" }, "paths": { "/payments": { "get": { "operationId": "listPayments", "responses": { "200": { "description": "ok" } } } } } } }
HTTP 201
[Asserts]
jsonpath "$.project" == "docs-payments"

Every list takes ?project= (instance: the instance's resources only) and leaves out what the caller may not read:

# Her list holds her project's mocks only; the instance's sample is not hers.
GET {{password_url}}/_rustybin/mocks
Authorization: Bearer {{pia}}
HTTP 200
[Asserts]
jsonpath "$.mocks" count == 1
jsonpath "$.mocks[0].name" == "docs-pay-api"
jsonpath "$.mocks[0].can_manage" == true

GET {{password_url}}/_rustybin/mocks/petstore
Authorization: Bearer {{pia}}
HTTP 404

# An admin filters by project.
GET {{password_url}}/_rustybin/mocks?project=docs-payments
Authorization: Bearer {{admin}}
HTTP 200
[Asserts]
jsonpath "$.mocks" count == 1
jsonpath "$.mocks[0].name" == "docs-pay-api"

PATCH /_rustybin/mocks/{name} with project (a name, null or instance) moves a mock; PUT /_rustybin/tests/{name} with another project moves a test. A project's checkpoint (POST /_rustybin/checkpoints with project) keeps that project's mocks only, and its restore changes only those, never the instance's health toggle. A run of the saved tests (POST /_rustybin/tests/run) runs the tests the caller may run (project narrows it), and the history shows a member the runs of their project's tests. Checkpoints in the configuration repository and the test schedules stay the instance's.

Instance-wide things refuse a member of a project:

# Instance-wide things need instance roles.
GET {{password_url}}/_rustybin/settings
Authorization: Bearer {{pia}}
HTTP 403
[Asserts]
jsonpath "$.reason" == "permission_required"
jsonpath "$.permission" == "settings.read"

A demo pack is a project made for one customer's demo: applying the pack creates it, tearing the pack down deletes it with what it holds.

Delete a project

A project that holds mocks, saved tests, checkpoints or storyboards is deleted only with move_to (another project, or instance), which needs the write permission of each kind of resource in both; its members' roles there go with it:

# A project that holds resources is deleted only with move_to.
DELETE {{password_url}}/_rustybin/projects/docs-payments
Authorization: Bearer {{admin}}
HTTP 409
[Asserts]
jsonpath "$.reason" == "not_empty"
jsonpath "$.resources.mocks[0]" == "docs-pay-api"

DELETE {{password_url}}/_rustybin/projects/docs-payments?move_to=instance
Authorization: Bearer {{admin}}
HTTP 200
[Asserts]
jsonpath "$.deleted" == "docs-payments"
jsonpath "$.moved.mocks[0]" == "docs-pay-api"
jsonpath "$.moved.to" == "instance"

Single sign-on

An entry of sso.role_map may name a project: {group, project, roles} (kept as group=project:role role), so a group gives roles in a project at every sign-in. A group that gives roles in a project only takes no default roles. See single sign-on.

AI agents

An agent acting for a user follows the user's project roles at every call, within its own ceiling: it lists the tools the user holds somewhere, and each call checks the resource's project. The OAuth consent page shows what the agent will hold in each of the user's projects, and a member of a project only may grant a scope that gives them something there. A live traffic stream (GET /_rustybin/mocks/{name}/requests/stream) checks its caller again at every event and every few seconds: removed from the project, disabled or signed out, the caller gets nothing more and the stream ends. The AI spec job (POST /_rustybin/mocks/ai/spec) tells the model which mock names are taken from the names the caller may read only.

On every surface

SurfaceWhere
APIGET /_rustybin/projects; GET, PUT, DELETE /_rustybin/projects/{name} (?move_to=); project on POST /_rustybin/mocks, PATCH /_rustybin/mocks/{name}, POST /_rustybin/tests, PUT /_rustybin/tests/{name}, POST /_rustybin/tests/run, POST /_rustybin/checkpoints; ?project= on GET /_rustybin/mocks, /tests, /tests/export, /checkpoints; projects on POST /_rustybin/users and in the users' answers; projects in GET /_rustybin/session
Consolethe Project picker in the top bar (filters the mocks, saved tests and checkpoints; new ones go to it); a mock's Settings, Project (move it); Management, Users and roles: the Projects card (create, members, delete) and each user's project roles
CLIrustybin projects list, show, save, delete --move-to; --project on mocks list, mocks create, mocks move, tests list, tests save, tests run, checkpoint list, checkpoint save; users invite --project P=role (reference)
Management MCPlist_projects, save_project (confirmed when it gives a privileged role), delete_project (confirmed, move_to); project on list_mocks, create_mock, update_mock (a move), list_tests, save_test, run_tests, list_checkpoints, save_checkpoint; projects on invite_user (agent page)
rustybin.yamlprojects: with members by user name, project: on mocks and tests (instance as code)