openvibers/openvibe.network Commits

Network: Codes may subscribe to account export and deletion events (grant events.subscription.manage) (#178)

OP OpenVibers committed 30 days ago · 5f69195ddf · 1 file, +3 −0

Plan T16: OpenVibe.Codes now keeps the coding tasks people start on their own machines (`run_tasks`, Codes#62), so it answers account export and deletion (ADR-033) through openvibe-sdk/account-data.

The recipe's order:
1. Codes subscribes at boot. This PR grants `codes` → `events.subscription.manage` (openvibe.events).
2. Codes is redeployed and its two subscriptions are verified.
3. Only then come the account grants (`network.account.export.contribute` and `network.account.deletion.confirm`). Network waits on every holder of those, so granting them before Codes listens would stall exports and deletions.

**Tests:** `principals` and `restored-grants` pass.

Changes

ddiff --git a/server/identity/principals.js b/server/identity/principals.js
iindex 00591416..9ce0a9cc 100644
---- a/server/identity/principals.js
++++ b/server/identity/principals.js
@@@ -40,6 +40,9 @@ const DEFAULT_GRANTS = [
// Live is the issuer of the live.* kinds (its cosmetics), reads and equips for the people it serves.
['inventory', 'events.event.publish', 'openvibe.events', []],
['inventory', 'events.subscription.manage', 'openvibe.events', []],
++ // Plan T16: Codes keeps the coding tasks people start on their own machines (run_tasks), so it answers account
++ // export and deletion (ADR-033) and subscribes to them first; its account grants follow once it is subscribed.
++ ['codes', 'events.subscription.manage', 'openvibe.events', []],
// The Workshop (ADR-054 §6): a creator gives a badge to "@name"; Inventory resolves the name to a subject.
['inventory', 'identity.subject.resolve', SELF_AUDIENCE, []],
...['inventory.item.read', 'inventory.item.list', 'inventory.equip.manage', 'inventory.item.grant', 'inventory.item.consume', 'inventory.definition.manage']