feat: account share
This commit is contained in:
1 parent
3f78dbb490
commit
f4dade9eec
25 files changed
+1185
-331
No files matched your search
+15
-9
@@ -18,7 +18,7 @@ Every start copies the SQLite file aside before anything else runs, using SQLite
|
||||
## Calendar feeds
|
||||
|
||||
- `/calendar/<token>.ics` is an iCalendar feed anybody can subscribe to from Google Calendar, Apple Calendar or Outlook. Every person has their own token, created the first time they open `/calendar`, and their feed only carries the shifts assigned to them.
|
||||
- `/calendar` is the page holding those links: the rota only has a button pointing there, so it keeps showing nothing but who works each day. Each address sits in a readonly field with a **Copiar** button (clipboard when the browser allows it, selecting the field otherwise) plus a `webcal://` shortcut.
|
||||
- `/calendar` is the page holding those links: the rota only has a button pointing there, so it keeps showing nothing but who works each day. A shared login gets one feed per person it signs in for, each titled `Turnos de <pessoa>`. Each address sits in a readonly field with a **Copiar** button (clipboard when the browser allows it, selecting the field otherwise) plus a `webcal://` shortcut.
|
||||
- Administrators also get one shared feed with the whole rota, using the team token in `CALENDAR_TOKEN` (generated on first use and shown on `/admin/schedules`).
|
||||
- A feed publishes one month back and six months forward. Times carry the bar's timezone (`DTSTART;TZID=Europe/Lisbon:20261017T203000`) and the feed declares it in `X-WR-TIMEZONE` plus a `VTIMEZONE` block with the European summer-time rules (WET/WEST), so every client shows a night at 20:30 and keeps the right offset across the year. The zone comes from `TIMEZONE`; an unknown zone falls back to `Europe/Lisbon`. Times and names are private member data: the token is the only protection, so the shared link goes only to the team.
|
||||
- Each event title is `<pessoa> · <escala> · <horas>` so a list of shifts reads at a glance; a shift without a person keeps `<escala> · <horas>`.
|
||||
@@ -67,15 +67,21 @@ Every assignment on a lunch schedule page has a **Regenerate** button. An admini
|
||||
|
||||
**Limpar turnos** empties the `generated` shifts of a lunch schedule from the first day of a chosen month and year onwards, in that month and every later one, so they read as unassigned. No shift is deleted: rows keep their IDs, notes, source and completed request history, and stay `generated`, so **Aplicar rotação** fills them again. Manual assignments and completed swaps are never emptied. Open and pending change requests on an emptied shift are cancelled and the previous person is notified. Use it to force a recalculation from a known point instead of relying on the shifts that already exist.
|
||||
|
||||
## People and logins
|
||||
## People, logins and teams
|
||||
|
||||
- `email` and `phone` are optional.
|
||||
- A username and password are optional, but they are all-or-nothing: a person can either sign in or be rota-only. A username without a password (or the reverse) is not allowed, and a person without credentials can never sign in.
|
||||
- A username, when set, is unique.
|
||||
- Rota-only people can be assigned by an administrator, appear in rotations, and can be named as the target of a change request, but cannot accept it; an administrator completes the transfer on the schedule's own configuration page.
|
||||
- A **person** is somebody who works shifts. A person may be rota-only, with no way to sign in.
|
||||
- Signing in belongs to a **login account** (`login_accounts`): a username, a password, a label and the administrator flag. A person points at one account through `users.login_id`, and a person without one is rota-only. A person belongs to at most one account.
|
||||
- An administrator registers each person with one of three choices on `/admin/users`: **sem login**, **conta nova** (a username and a password created for that person alone) or **conta já existente** (an existing account, shared). Editing a person starts on **manter** the current access, so nothing is lost by saving the form without choosing.
|
||||
- A username belongs to the login account and is unique across accounts, not across people: several people may sign in with the same username.
|
||||
- `/admin/logins` lists the accounts: rename them, change the password, grant or withdraw administration, deactivate them, create an empty one ready to be shared, and remove an account once nobody uses it.
|
||||
- Administration is a property of the **account**, so everyone signing in through an administrator account is an administrator. An account cannot be deactivated, demoted or removed while it is the last one that can sign in as an administrator, and nobody can remove or deactivate the account they are signed in with.
|
||||
- Rota-only people can be assigned by an administrator, appear in rotations, and can be named as the target of a change request, but cannot answer it; an administrator completes the transfer on the schedule's own configuration page.
|
||||
- Any password of at least four characters is accepted; there is no complexity rule.
|
||||
- A signed-in person reaches their account through their username in the top bar, which opens `/account`: a single field for the new password, with no confirmation and no retyping of the current one, so anyone holding an open session can change it. Accounts without a password have no username and no link, and need an administrator to set one.
|
||||
- A person cannot remove their own login.
|
||||
- The session stores the login account, never a person. Everything a member sees and does is scoped to the people sharing that account: their shifts are the "mine" ones on the rota, their change requests are the ones listed, their calendar page holds one feed per person, and they can open and answer requests for any of them. A request made by one of them is their own: nobody in the account can accept it, and a swap that names a teammate as the other side is refused.
|
||||
- When a shared account accepts a request, the rota still records one person: the one the request names, or the account's first active person when the request names nobody. Ownership rules are checked against that person.
|
||||
- A signed-in person reaches their account through the top bar, which opens `/account`: a single field for the new password, with no confirmation and no retyping of the current one, so anyone holding an open session can change it. The page lists the people the account signs in for.
|
||||
- A person cannot be deactivated or lose their access while they are the only person of the account you are signed in with, and cannot lose it altogether on the people form.
|
||||
- An administrator can remove a person permanently from `/admin/users`, after a confirmation page that lists the impact. A person who still holds any assignment, past ones included, cannot be removed: those shifts must first be handed over, so the record of who worked each date stays intact. SQLite cascades are not enforced by the application, so the removal clears the remaining references explicitly: night-pattern days lose their person, rotation positions are deleted, that person's own change requests are deleted and the ones that merely targeted or accepted by them lose those references, and notification logs keep their history without the person. - Nobody may remove their own account or the last remaining administrator. The people page only shows the remove button for the people who pass these checks; the endpoints enforce them again. Deactivating is the non-destructive alternative.
|
||||
|
||||
## Access
|
||||
@@ -97,8 +103,8 @@ Other terminal states: `rejected`, `cancelled`, `reverted`.
|
||||
- A shift can only be part of one open request at a time, on either side.
|
||||
- An administrator can open a request for someone else's shift. The request is still recorded against the person who owns the shift, so the ownership rule below keeps working; unassigned and past shifts cannot be requested.
|
||||
- `/admin/assign` is the day-by-day picker for administrators: pick a day, then put someone on one of its shifts with **Atribuir**. This is a direct assignment, never a change request. It sets the assignment source to `manual`, cancels any open request that involves that shift, and notifies both the new and the previous person. `Sem atribuição` clears it. The date must match one of the schedule's weekdays.
|
||||
- The requester cannot accept their own request.
|
||||
- Only the person the request names can accept it or decline it.
|
||||
- The requester cannot accept their own request. With a shared login, that covers every person on it.
|
||||
- Only the person the request names can accept it or decline it, and with a shared login that means the account the named person signs in through.
|
||||
- If the schedule requires manager approval, acceptance moves to `pending_approval`.
|
||||
- Nobody can decline their own request; the requester cancels it instead. An administrator may decline any `open` or `pending_approval` request.
|
||||
- An administrator can approve a `pending_approval` request (it goes to whoever accepted it) or an `open` one, choosing another person of the same schedule when there is no named partner. Approval and decline are available both in `/swaps` and on the rota page next to the shift.
|
||||
|
||||
Reference in new issue
Block a user