Skip to Content
SimulatorsDropboxShared folders and file members

Simulators

Shared folders and file members

A shared folder is one folder seen by every member, and a shared file belongs to the people it was shared with. The team scenario holds two Acme members, Rosa and Toni, told apart by token. Load it, then read the folders each of them has:

R='Authorization: Bearer sl.rosa-desktop'
T='Authorization: Bearer sl.toni-laptop'
J='Content-Type: application/json'
O='Content-Type: application/octet-stream'
curl -s -X POST "$RYSTIC_URL/_rystic/scenario" -d '{"name":"dropbox_team_shared"}'
curl -s "$RYSTIC_URL/2/sharing/list_folders" -H "$R" -H "$J" -d '{}' | jq -c '[.entries[] | {name, access: .access_type[".tag"]}]'
# -> [{"name":"Acme Inc Team Folder","access":"owner"},{"name":"Engineering","access":"owner"},{"name":"Marketing","access":"viewer"}]
curl -s "$RYSTIC_URL/2/sharing/list_folders" -H "$T" -H "$J" -d '{}' | jq -c '[.entries[] | {name, access: .access_type[".tag"]}]'
# -> [{"name":"Acme Inc Team Folder","access":"editor"},{"name":"Engineering","access":"editor"},{"name":"Marketing","access":"owner"}]

Toni owns Marketing and Rosa is a viewer there. A write by one member reaches the other, and a viewer’s write is refused:

curl -s "$RYSTIC_URL/2/files/upload" -H "$T" -H "$O" -H 'Dropbox-API-Arg: {"path":"/Acme Inc Team Folder/Marketing/plan.txt"}' --data-binary 'plan' | jq -c '{name}'
# -> {"name":"plan.txt"}
curl -s "$RYSTIC_URL/2/files/list_folder" -H "$R" -H "$J" -d '{"path":"/Acme Inc Team Folder/Marketing"}' | jq -c '[.entries[].name]'
# -> ["launch-brief.docx","plan.txt"]
curl -s "$RYSTIC_URL/2/files/upload" -H "$R" -H "$O" -H 'Dropbox-API-Arg: {"path":"/Acme Inc Team Folder/Marketing/rosa.txt"}' --data-binary 'rosa' | jq -c '.error.reason'
# -> {".tag":"no_write_permission"}

The scenario also plays a timeline on the clock:

ClockEvent
15 minutesToni creates a private /Drafts folder
20 minutesToni uploads /Drafts/api-sketch.md
25 minutesToni shares that file with Rosa
2 hoursRosa moves /Scratch/private-notes.txt to /Acme Inc Team Folder/Engineering/meeting-notes.txt
3 hoursRosa deletes /Scratch

Rosa receives the shared file, not the folder:

curl -s "$RYSTIC_URL/2/files/get_metadata" -H "$R" -H "$J" -d '{"path":"/Drafts"}' | jq -c '.error.path'
# -> {".tag":"not_found"}
curl -s -X POST "$RYSTIC_URL/_rystic/clock" -d '{"advance_seconds":3600}'
curl -s "$RYSTIC_URL/2/sharing/list_received_files" -H "$R" -H "$J" -d '{}' | jq -c '[.entries[].name]'
# -> ["api-sketch.md"]

Shared folders

share_folder gives a folder sharing_info with its shared_folder_id, and everything under it sharing_info.parent_shared_folder_id. A member who mounts it lists the same tree, and an upload, move, copy or delete by any member reaches the owner and every other member. Each caller reads its own read_only: true for a viewer.

The account that shares a folder is its owner: list_folders lists the share, and get_folder_metadata and list_folder_members return it with access_type owner. unmount_folder, relinquish_folder_membership and remove_folder_member take the share out of that member’s Dropbox, leaving a plain copy when asked to, and unshare_folder leaves the owner the folder without sharing_info. add_folder_member, mount_folder and the other membership routes manage who sees it. In dropbox_team_shared the shares 92001001, 92001002 and 92001003 resolve on every sharing route.

Files and file members

Each account holds its own files, apart from the shared folders it has mounted. Toni’s /Drafts returns path/not_found to Rosa. What reaches her is the file Toni shared, through sharing/list_received_files and sharing/get_file_metadata. File members and a file’s sharing record belong to the file’s id, so two accounts’ files at one path keep their own.

add_file_member gives an account access to a file, which list_file_members then lists and get_file_metadata reports. update_file_member changes that access, and remove_file_member_2, unshare_file and relinquish_file_membership end it. No invite email goes out; the member appears in the listing.

Invites

Differs from Dropbox: the simulator has no daily invite cap and never refuses an invite. Dropbox refuses add_file_member and add_folder_member with 409 rate_limit or banned_member once an account has sent its day’s invites.

Last updated on