Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/js/dist/login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/login.js.map

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions core/js/dist/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/share_backend.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/js/dist/share_backend.js.map

Large diffs are not rendered by default.

17 changes: 0 additions & 17 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ var OCP = Object.assign({}, window.OCP);
*/
Object.assign(window.OC, {
/* jshint camelcase: false */
/**
* Capabilities
*
* @type array
*/
_capabilities: window.oc_capabilities || null,

theme: window.oc_defaults || {},

Expand Down Expand Up @@ -70,17 +64,6 @@ Object.assign(window.OC, {
return window.location.port;
},

/**
* Returns the capabilities
*
* @return {array} capabilities
*
* @since 14.0
*/
getCapabilities: function() {
return OC._capabilities;
},

/**
* Loads translations for the given app asynchronously.
*
Expand Down
4 changes: 2 additions & 2 deletions core/js/sharedialoglinkshareview.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@

var minPasswordLength = 4
// password policy?
if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) {
minPasswordLength = oc_capabilities.password_policy.minLength;
if(OC.getCapabilities().password_policy && OC.getCapabilities().password_policy.minLength) {
minPasswordLength = OC.getCapabilities().password_policy.minLength;
}

var popoverBase = {
Expand Down
31 changes: 31 additions & 0 deletions core/src/OC/capabilities.js
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions core/src/OC/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
*/
Expand Down
1 change: 1 addition & 0 deletions core/src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Template/JSConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function getConfig() {
'longFooter' => $this->defaults->getLongFooter(),
'folder' => \OC_Util::getTheme(),
]),
"oc_capabilities" => json_encode($capabilities),
"_oc_capabilities" => json_encode($capabilities),
];

if ($this->currentUser !== null) {
Expand Down
2 changes: 1 addition & 1 deletion settings/js/vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion settings/js/vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ const actions = {


getPasswordPolicyMinLength(context) {
if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) {
context.commit('setPasswordPolicyMinLength', oc_capabilities.password_policy.minLength);
return oc_capabilities.password_policy.minLength;
if(OC.getCapabilities().password_policy && OC.getCapabilities().password_policy.minLength) {
context.commit('setPasswordPolicyMinLength', OC.getCapabilities().password_policy.minLength);
return OC.getCapabilities().password_policy.minLength;
}
return false;
},
Expand Down