Skip to content

Epic: several classes on one phone, and how a phone gets into one #90

Closed
3 of 3 issues completed
Closed

Description

@lumenpearson

Delivered in 8ec2e31, with the join modes in 59c7a77. Back-filled for the record.

The phone keeps a list of memberships, shows one of them and switches instantly; the cache is split by class, so switching works with no network.

A phone gets into a class two ways, and one of them is not read-only.

length buys
the class code eight characters an anonymous, read-only token
a personal code from «📱 Подключить телефон» ten characters, fifteen minutes, one phone a token already linked to the account that minted it, writing with that account's role

Both go into the same code field of the same POST /api/v1/join; they cannot collide because the lengths differ, and the class code is looked up first. SchoolClass.join_mode decides whether the class code opens anything at all; switching it revokes no device, in either direction, and three screens promise that out loud.

A 403 from /join means the class takes invites only, and it is deliberately not counted against the throttle, because that caller had a real code.

There are two independent bearer tokens and they are not interchangeable: the device token from POST /api/v1/join (api/deps.py:current_device) and the diary session token from POST /api/v1/diary/login (api/diary.py:current_diary). A phone can be joined to a class without a diary account and signed in to a diary without a class.

Six defects that four audits found in the first version of this are recorded in the sweep issues; the serious one was that a 401 on one class threw the device out of all of them.

Sub-issues

Sub-issues

3 of 3 Issues completed
Loading 3 sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions