openvibers/openvibe.network Commits

Design may publish a person's design on Space (open item D8) (#532)

OP OpenVibers committed 11 days ago · d1f4e3bfad · 2 files, +8 −0

Design publishes a design's working frame as a static site on openvibe.space, acting for the person who made it
(X-OV-Subject): their 'Designs' project and its sites, and the deploy of the page. Nothing else on Space.

Changes

ddiff --git a/server/identity/principals.js b/server/identity/principals.js
iindex fa1786eb..3279c44d 100644
---- a/server/identity/principals.js
++++ b/server/identity/principals.js
@@@ -702,6 +702,10 @@ const DEFAULT_GRANTS = [
['design', 'bench.judgement.cast', 'openvibe.bench', []],
['design', 'bench.board.read', 'openvibe.bench', []],
['design', 'bench.entry.create', 'openvibe.bench', []],
++ // Open item D8 (11-02): Design publishes a person's design as a static site on Space, acting for them
++ // (X-OV-Subject): the person's "Designs" project and its sites, and the deploy of the page.
++ ['design', 'space.site.manage', 'openvibe.space', []],
++ ['design', 'space.deploy.create', 'openvibe.space', []],
// Games submits each AI duel as a Bench task, two priced seat entries, and one automatic outcome.
...['bench.task.create', 'bench.round.create', 'bench.entry.create', 'bench.judgement.cast']
.map((cap) => ['games', cap, 'openvibe.bench', []]),
ddiff --git a/test/principals.test.js b/test/principals.test.js
iindex e6988461..2f30ae00 100644
---- a/test/principals.test.js
++++ b/test/principals.test.js
@@@ -188,6 +188,10 @@ const server = http.createServer(app);
t = await token({ client_id: 'design', client_secret: 'design-secret', audience: 'openvibe.bench' });
assert.strictEqual(t.status, 200, JSON.stringify(t.body));
assert.deepStrictEqual(t.body.scope.split(' '), ['bench.board.read', 'bench.entry.create', 'bench.judgement.cast', 'bench.round.create', 'bench.round.read', 'bench.task.create'], "Design creates and reads Bench tasks and rounds, reads boards and casts judgements");
++ // Open item D8: Design publishes a person's design on Space, acting for them.
++ t = await token({ client_id: 'design', client_secret: 'design-secret', audience: 'openvibe.space' });
++ assert.strictEqual(t.status, 200, JSON.stringify(t.body));
++ assert.deepStrictEqual(t.body.scope.split(' ').sort(), ['space.deploy.create', 'space.site.manage'], 'Design makes the site and deploys the page, nothing else on Space');
await db.prepare("UPDATE oauth_clients SET client_secret = 'games-secret' WHERE client_id = 'games'").run();
t = await token({ client_id: 'games', client_secret: 'games-secret', audience: 'openvibe.bench' });
assert.strictEqual(t.status, 200, JSON.stringify(t.body));