Files
ocis/web/packages/web-client
Matteo 380273bb84 Feat/ocisdev 949/disable direct sharing (#12542)
* build(deps): [OCISDEV-949] bump reva to v2.0.0-20260709150645-a9d5432e6f7f

Includes owncloud/reva#651, which adds the enable_user_sharing and
enable_public_sharing config options this feature depends on.

* feat: [OCISDEV-949] add options to disable direct and public sharing

Adds two independent, per-deployment config options:

- OCIS_ENABLE_USER_SHARING (default true), read by the frontend, graph,
  sharing and ocm services. When false, creating new user, group or
  federated shares is rejected (via reva's usershareprovider and
  ocmshareprovider, and via the graph Invite endpoint for the modern web
  client), the legacy sharees search endpoint returns no results, and
  the files_sharing.user.enabled / user_enumeration.enabled capabilities
  report false so the web UI hides the "share with people" search.
  Space membership invites are exempt.

- OCIS_ENABLE_PUBLIC_SHARING (default true), read by the frontend and
  sharing services. When false, creating new public links is rejected
  via reva's publicshareprovider, and files_sharing.public.enabled
  reports false so the web UI hides public link creation.

The two settings are fully independent of each other.
2026-07-10 11:59:08 +02:00
..

web-client

The web-client is a standalone package that allows you to interact with the ownCloud Infinite Scale (oCIS) APIs via TypeScript. It provides an abstraction layer between the server and a (web-) application that converts API data into objects with helpful types and utilities. This abstraction ensures that users of the APIs don't need in-depth knowledge about them, such as required methods or returned status codes.

The supported APIs are:

  • Graph (drives, sharing, user & group management)
  • OCS (capabilities & url signing)
  • WebDAV (file operations)

Installation

Depending on your package manager, run one of the following commands:

$ npm install @ownclouders/web-client

$ pnpm add @ownclouders/web-client

$ yarn add @ownclouders/web-client

Usage

Graph

The graph client needs to be instantiated with a base URI corresponding to your oCIS deployment and an axios instance. The axios instance is being used for all requests, which means it needs to include all relevant headers either statically or via interceptor.

import axios from axios
import { graph } from '@ownclouders/web-client'

const accessToken = 'some_access_token'
const baseURI = 'some_base_uri'

const axiosClient = axios.create({
	headers: { Authorization: accessToken }
})

const graphClient = graph(baseURI, axiosClient)

The following example demonstrates how to retrieve all spaces accessible to the user. A SpaceResource can then be used to e.g. fetch files and folders (see webdav example down below).

const mySpaces = await graphClient.drives.listMyDrives()

OCS

The ocs client needs to be instantiated with a base URI corresponding to your oCIS deployment and an axios instance. The axios instance is being used for all requests, which means it needs to include all relevant headers either statically or via interceptor.

import axios from axios
import { ocs } from '@ownclouders/web-client'

const accessToken = 'some_access_token'
const baseURI = 'some_base_uri'

const axiosClient = axios.create({
	headers: { Authorization: accessToken }
})

const ocsClient = ocs(baseURI, axiosClient)

The following examples demonstrate how to fetch capabilities and sign URLs.

const capabilities = await ocsClient.getCapabilities()

const signedUrl = await ocsClient.signUrl('some_url_to_sign', 'your_username')

WebDav

The webdav client needs to be instantiated with a base URI corresponding to your oCIS deployment. You can also pass a header callback which will be called with every dav request.

import { webdav } from '@ownclouders/web-client'

const accessToken = 'some_access_token'
const baseURI = 'some_base_uri'

const webDavClient = webdav(
	baseURI,
	() => ({ Authorization: accessToken })
)

The following example demonstrates how to list all resources of a given SpaceResource (see above how to fetch space resources).

const { resource, children } = await webDavClient.listFiles(spaceResource)