mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
docs: Remove non-exported getAccessController from docs.
This commit is contained in:
parent
3eee148510
commit
0eb228b530
@ -8,15 +8,13 @@ Different access controllers can be assigned to the database using the `AccessCo
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import { create } from 'ipfs-core'
|
import { create } from 'ipfs-core'
|
||||||
import { createOrbitDB, getAccessController } from '@orbitdb/core'
|
import { createOrbitDB } from '@orbitdb/core'
|
||||||
|
import * as SomeAccessController from 'some-access-controller.js'
|
||||||
|
|
||||||
const ipfs = create({ options })
|
const ipfs = create({ options })
|
||||||
|
|
||||||
const orbitdb = await createOrbitDB({ ipfs })
|
const orbitdb = await createOrbitDB({ ipfs })
|
||||||
|
|
||||||
// SomeAccessController must already be available in the AC list.
|
|
||||||
const SomeAccessController = getAccessController('some-access-controller')
|
|
||||||
|
|
||||||
const db = orbitdb.open('my-db', { AccessController: SomeAccessController() })
|
const db = orbitdb.open('my-db', { AccessController: SomeAccessController() })
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -37,7 +35,7 @@ To change write access, pass the IPFSAccessController with the `write` parameter
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import { create } from 'ipfs-core'
|
import { create } from 'ipfs-core'
|
||||||
import { createOrbitDB, Identities, getAccessController } from '@orbitdb/core'
|
import { createOrbitDB, Identities, IPFSAccessController } from '@orbitdb/core'
|
||||||
|
|
||||||
const ipfs = create({ options })
|
const ipfs = create({ options })
|
||||||
|
|
||||||
@ -47,9 +45,6 @@ const anotherIdentity = identities.createIdentity('userB')
|
|||||||
// OrbitDB will create an identity using the id 'UserA'.
|
// OrbitDB will create an identity using the id 'UserA'.
|
||||||
const orbitdb = await createOrbitDB({ ipfs, id: 'userA' })
|
const orbitdb = await createOrbitDB({ ipfs, id: 'userA' })
|
||||||
|
|
||||||
// Retrieve the access controller from the list of preloaded ACs.
|
|
||||||
const IPFSAccessController = getAccessController('ipfs')
|
|
||||||
|
|
||||||
// Open a db with write access for userA and userB.
|
// Open a db with write access for userA and userB.
|
||||||
const db = orbitdb.open('my-db', { AccessController: IPFSAccessController({ write: [orbitdb.identity.id, anotherIdentity.id]) })
|
const db = orbitdb.open('my-db', { AccessController: IPFSAccessController({ write: [orbitdb.identity.id, anotherIdentity.id]) })
|
||||||
```
|
```
|
||||||
@ -58,14 +53,12 @@ To allow anyone to write to the database, specify the wildcard '*':
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import { create } from 'ipfs-core'
|
import { create } from 'ipfs-core'
|
||||||
import { createOrbitDB, Identities, getAccessController } from '@orbitdb/core'
|
import { createOrbitDB, Identities, IPFSAccessController } from '@orbitdb/core'
|
||||||
|
|
||||||
const ipfs = create({ options })
|
const ipfs = create({ options })
|
||||||
|
|
||||||
const orbitdb = await createOrbitDB({ ipfs })
|
const orbitdb = await createOrbitDB({ ipfs })
|
||||||
|
|
||||||
const IPFSAccessController = getAccessController('ipfs')
|
|
||||||
|
|
||||||
const db = orbitdb.open('my-db', { AccessController: IPFSAccessController({ write: ['*'] }) })
|
const db = orbitdb.open('my-db', { AccessController: IPFSAccessController({ write: ['*'] }) })
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -77,7 +70,7 @@ The OrbitDB access controller provides configurable write access using grant and
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import { create } from 'ipfs-core'
|
import { create } from 'ipfs-core'
|
||||||
import { createOrbitDB, Identities, getAccessController } from '@orbitdb/core'
|
import { createOrbitDB, Identities, OrbitDBAccessController } from '@orbitdb/core'
|
||||||
|
|
||||||
const ipfs = create({ options })
|
const ipfs = create({ options })
|
||||||
|
|
||||||
@ -86,9 +79,6 @@ const orbitdb = await createOrbitDB({ ipfs })
|
|||||||
const identities = await Identities()
|
const identities = await Identities()
|
||||||
const anotherIdentity = identities.createIdentity('userB')
|
const anotherIdentity = identities.createIdentity('userB')
|
||||||
|
|
||||||
// Retrieve the access controller from the list of preloaded ACs.
|
|
||||||
const OrbitDBAccessController = getAccessController('orbitdb')
|
|
||||||
|
|
||||||
const db = orbitdb.open('my-db', { AccessController: OrbitDBAccessController({ write: [orbitdb.identity.id, anotherIdentity.id]) })
|
const db = orbitdb.open('my-db', { AccessController: OrbitDBAccessController({ write: [orbitdb.identity.id, anotherIdentity.id]) })
|
||||||
|
|
||||||
db.access.grant('write', anotherIdentity.id)
|
db.access.grant('write', anotherIdentity.id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user