Hub JS Package

Hub JS Package

  • Users
  • Buckets
  • Threads
  • Textile Docs

›Buckets

Buckets

  • Buckets.copyAuth() method
  • Buckets.withUserAuth() method
  • Buckets.withKeyInfo() method
  • Buckets.getToken() method
  • Buckets.getTokenChallenge() method
  • Buckets.setToken() method
  • Buckets.withThread() method
  • Buckets.getOrCreate() method
  • Buckets.create() method
  • Buckets.existing() method
  • Buckets.root() method
  • Buckets.links() method
  • Buckets.list() method
  • Buckets.listPath() method
  • Buckets.listPathFlat() method
  • Buckets.listIpfsPath() method
  • Buckets.movePath() method
  • Buckets.open() method
  • Buckets.pushPath() method
  • Buckets.pushPaths() method
  • Buckets.pushPathAccessRoles() method
  • Buckets.pullPath() method
  • Buckets.pullPathAccessRoles() method
  • Buckets.pullIpfsPath() method
  • Buckets.remove() method
  • Buckets.removePath() method
  • Buckets.setPath() method

Experimental

  • Archive interface
  • ArchiveDealInfo interface
  • ArchiveStatus enum

Types

  • GetOrCreateOptions interface
  • GetOrCreateResponse interface
  • CreateOptions interface
  • CreateResponse interface
  • Links interface
  • Path interface
  • PathAccessRole enum
  • PathItem interface
  • Root interface
  • BuckMetadata interface

@textile/hub > Buckets > pushPathAccessRoles

Buckets.pushPathAccessRoles() method

Push new access roles per path in a Bucket

Signature:

pushPathAccessRoles(key: string, path: string, roles: Map<string, PathAccessRole>): Promise<void>;

Parameters

ParameterTypeDescription
keystringUnique (IPNS compatible) identifier key for a bucket.
pathstringA relative path within a bucket.
rolesMap<string, PathAccessRole>Each user public key and the roles they will receive.

Returns:

Promise<void>

Example 1

import { Buckets, PublicKey } from '@textile/hub'

const grant = async (buckets: Buckets, key: string, peer: PublicKey) => {
   const roles = new Map()
   // NA = 0, Reader = 1, Writer = 2, Admin = 3
   roles.set(peer.toString(), 2)
   buckets.pushPathAccessRoles(key, '/', roles)
}

Example 2

Grant read access to everyone at a path (in an encrypted bucket)

import { Buckets } from '@textile/hub'

const grant = async (buckets: Buckets, key: string) => {
   const roles = new Map()
   // NA = 0, Reader = 1, Writer = 2, Admin = 3
   roles.set('*', 1)
   buckets.pushPathAccessRoles(key, '/folder/containing/shared/things', roles)
}

← PreviousBuckets.pullPath() method →
  • Buckets.pushPathAccessRoles() method
  • Parameters
  • Example 1
  • Example 2
Hub JS Package
Docs
Getting StartedThreadDBBuckets
Resources
All DocumentationProject SlackBlog
More
GitHubStar
Follow @textileio