From 6b46d9f2e5069f3d3ad8ff0da9df752bf3c3ef3f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 13 May 2019 21:29:40 +0200 Subject: Move OC.getCapabilities to the bundle and deprecate OC._capabilities, oc_capabilities Signed-off-by: Christoph Wurst --- core/src/OC/capabilities.js | 31 +++++++++++++++++++++++++++++++ core/src/OC/index.js | 10 ++++++++++ core/src/globals.js | 1 + 3 files changed, 42 insertions(+) create mode 100644 core/src/OC/capabilities.js (limited to 'core/src') diff --git a/core/src/OC/capabilities.js b/core/src/OC/capabilities.js new file mode 100644 index 00000000000..1adfe80d288 --- /dev/null +++ b/core/src/OC/capabilities.js @@ -0,0 +1,31 @@ +/* + * @copyright 2019 Christoph Wurst + * + * @author 2019 Christoph Wurst + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +const capabilities = window._oc_capabilities || {} + +/** + * Returns the capabilities + * + * @return {Array} capabilities + * + * @since 14.0 + */ +export const getCapabilities = () => capabilities diff --git a/core/src/OC/index.js b/core/src/OC/index.js index 3a76361d476..a346c32f033 100644 --- a/core/src/OC/index.js +++ b/core/src/OC/index.js @@ -49,6 +49,7 @@ import {currentUser, getCurrentUser} from './currentuser' import Dialogs from './dialogs' import EventSource from './eventsource' import {get, set} from './get_set' +import {getCapabilities} from './capabilities' import { getToken as getRequestToken, subscribe as subscribeToRequestTokenChange, @@ -130,6 +131,15 @@ export default { isUserAdmin, L10N, + /** + * Capabilities + * + * @type {Array} + * @deprecated 17.0.0 use OC.getCapabilities() instead + */ + _capabilities: getCapabilities(), + getCapabilities, + /* * Legacy menu helpers */ diff --git a/core/src/globals.js b/core/src/globals.js index 48955f11d3a..2ec37c480cd 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -119,6 +119,7 @@ window['moment'] = moment window['OC'] = OC setDeprecatedProp('initCore', () => initCore, 'this is an internal function') setDeprecatedProp('oc_appswebroots', () => OC.appswebroots, 'use OC.appswebroots instead') +setDeprecatedProp('oc_capabilities', OC.getCapabilities, 'use OC.getCapabilities instead') setDeprecatedProp('oc_config', () => OC.config, 'use OC.config instead') setDeprecatedProp('oc_current_user', () => OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead') setDeprecatedProp('oc_debug', () => OC.debug, 'use OC.debug instead') -- cgit v1.2.3