Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions bin/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ export const conf = {
// latter is safe here only because `credentials` stays off; browsers reject that pair.
cors: corsOrigin === null ? undefined : { origin: corsOrigin.includes(',') ? corsOrigin.split(',').map(origin => origin.trim()).filter(origin => origin !== '') : corsOrigin.trim() },
auth: types.createAuthPlugin({
// this demo configuration picks a "unique" userid and grants everyone full document
// access - including the destructive permissions the old blanket 'rw' implied. No
// org/branch/global grants: scopes without a handler deny, and this demo serves no
// endpoints at those scopes.
async authenticate (_req) { return { userid: random.oneOf(userIdChoices) } },
// Open demo server: the userid is taken straight from the connection
// string (e.g. ws://host/ws/:org/:docid?userid=alice). Attributions are
// saved against this userid. Falls back to a random name when omitted.
async authenticate (req) {
const userid = req.getQuery('userid')
return { userid: userid || random.oneOf(userIdChoices) }
},
// this demo configuration grants everyone full document access - including the
// destructive permissions the old blanket 'rw' implied. No org/branch/global grants:
// scopes without a handler deny, and this demo serves no endpoints at those scopes.
authorize: types.createAuthorize({
document: async () => ({
type: 'permissions:document:v1',
Expand Down