summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-05-13 21:29:40 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-05-13 21:30:01 +0200
commit6b46d9f2e5069f3d3ad8ff0da9df752bf3c3ef3f (patch)
treea39bc78348aac2f07e34d1259ec33ce3967f44a3 /core/src
parent5ee6872c8ab688451b2489d35a9a19bbce457e98 (diff)
downloadnextcloud-server-6b46d9f2e5069f3d3ad8ff0da9df752bf3c3ef3f.tar.gz
nextcloud-server-6b46d9f2e5069f3d3ad8ff0da9df752bf3c3ef3f.zip
Move OC.getCapabilities to the bundle and deprecate OC._capabilities, oc_capabilities
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src')
-rw-r--r--core/src/OC/capabilities.js31
-rw-r--r--core/src/OC/index.js10
-rw-r--r--core/src/globals.js1
3 files changed, 42 insertions, 0 deletions
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 <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+
+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')