openvibers/openvibe.network Commits
Connect may push 'it is back' notifications (CON-17) (#535)
Changes
@@@ -665,6 +665,9 @@ const DEFAULT_GRANTS = [// OpenVibe Connect (contracts 0.279.0, Website Connect v0): its account-event subscriptions at boot. It publishes// nothing yet; export and deletion are above.['connect', 'events.subscription.manage', 'openvibe.events', []],++ // "Tell me when it's back" (CON-17, 11-02): one notification, as app connect, to a person who asked when a share's++ // computer connects again. Nothing else of Network's notifications.++ ['connect', 'network.notifications.push', SELF_AUDIENCE, ['connect']],// OpenVibe.Report (contracts 0.237.0): it quotes Billing's read API and never computes money, so it holds the// stats read and the per-subject balance read; it subscribes to live.stream.ended and the frame beacon at boot.// It keeps nothing about people (no database and no account-data route), so it holds neither export nor deletion.nnew file mode 100644@@@ -0,0 +1,16 @@++/**++ * OpenVibe Connect's notification grant (CON-17, "tell me when it's back"): Connect pushes one notification as app++ * connect to a person who asked, and holds nothing else of Network's notifications.++ *++ * node test/connect-notify-grant.test.js++ */++'use strict';++const assert = require('assert');++const contracts = require('openvibe-contracts');++const principals = require('../server/identity/principals');++++const rows = principals.DEFAULT_GRANTS.filter((g) => g[0] === 'connect' && g[2] === principals.SELF_AUDIENCE && /^network\.notifications\./.test(g[1]));++assert.deepStrictEqual(rows.map((g) => [g[1], g[3]]), [['network.notifications.push', ['connect']]], 'connect pushes as its own app only, and holds nothing else of Network\'s notifications');++const cap = contracts.capabilities.get('network.notifications.push');++assert.ok(cap && cap.status === 'active', 'an active capability');++console.log('connect notify grant: ok');
@@ -665,6 +665,9 @@ const DEFAULT_GRANTS = [
@@ -665,6 +665,9 @@ const DEFAULT_GRANTS = [
// OpenVibe Connect (contracts 0.279.0, Website Connect v0): its account-event subscriptions at boot. It publishes
// OpenVibe Connect (contracts 0.279.0, Website Connect v0): its account-event subscriptions at boot. It publishes
// nothing yet; export and deletion are above.
// nothing yet; export and deletion are above.
['connect', 'events.subscription.manage', 'openvibe.events', []],
['connect', 'events.subscription.manage', 'openvibe.events', []],
+ // "Tell me when it's back" (CON-17, 11-02): one notification, as app connect, to a person who asked when a share's
+ // computer connects again. Nothing else of Network's notifications.
+ ['connect', 'network.notifications.push', SELF_AUDIENCE, ['connect']],
// OpenVibe.Report (contracts 0.237.0): it quotes Billing's read API and never computes money, so it holds the
// OpenVibe.Report (contracts 0.237.0): it quotes Billing's read API and never computes money, so it holds the
// stats read and the per-subject balance read; it subscribes to live.stream.ended and the frame beacon at boot.
// stats read and the per-subject balance read; it subscribes to live.stream.ended and the frame beacon at boot.
// It keeps nothing about people (no database and no account-data route), so it holds neither export nor deletion.
// It keeps nothing about people (no database and no account-data route), so it holds neither export nor deletion.
new file mode 100644
new file mode 100644
@@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
+/**
+ * OpenVibe Connect's notification grant (CON-17, "tell me when it's back"): Connect pushes one notification as app
+ * connect to a person who asked, and holds nothing else of Network's notifications.
+ *
+ * node test/connect-notify-grant.test.js
+ */
+'use strict';
+const assert = require('assert');
+const contracts = require('openvibe-contracts');
+const principals = require('../server/identity/principals');
+
+const rows = principals.DEFAULT_GRANTS.filter((g) => g[0] === 'connect' && g[2] === principals.SELF_AUDIENCE && /^network\.notifications\./.test(g[1]));
+assert.deepStrictEqual(rows.map((g) => [g[1], g[3]]), [['network.notifications.push', ['connect']]], 'connect pushes as its own app only, and holds nothing else of Network\'s notifications');
+const cap = contracts.capabilities.get('network.notifications.push');
+assert.ok(cap && cap.status === 'active', 'an active capability');
+console.log('connect notify grant: ok');