diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-03 09:07:31 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-05-03 15:49:49 +0200 |
commit | d68be1ae4dd1abbd64c8075ca495d55dc1f491db (patch) | |
tree | 49bb52498acb8940f1fd6d10af22eb1f9b9ede57 /core/src | |
parent | a7a35d32fd04d7bdc27261a1fa4a51c91c0b2cab (diff) | |
download | nextcloud-server-d68be1ae4dd1abbd64c8075ca495d55dc1f491db.tar.gz nextcloud-server-d68be1ae4dd1abbd64c8075ca495d55dc1f491db.zip |
Deprecate oc_isadmin and move OC.isUserAdmin() to the bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/OC/admin.js | 30 | ||||
-rw-r--r-- | core/src/OC/index.js | 2 | ||||
-rw-r--r-- | core/src/globals.js | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/core/src/OC/admin.js b/core/src/OC/admin.js new file mode 100644 index 00000000000..565af9946f7 --- /dev/null +++ b/core/src/OC/admin.js @@ -0,0 +1,30 @@ +/* + * @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 isAdmin = !!window._oc_isadmin + +/** + * Returns whether the current user is an administrator + * + * @return {bool} true if the user is an admin, false otherwise + * @since 9.0.0 + */ +export const isUserAdmin = () => isAdmin diff --git a/core/src/OC/index.js b/core/src/OC/index.js index 308324ff4bd..dd618e7a1a0 100644 --- a/core/src/OC/index.js +++ b/core/src/OC/index.js @@ -26,6 +26,7 @@ import Config from './config' import ContactsMenu from './contactsmenu' import Dialogs from './dialogs' import EventSource from './eventsource' +import {isUserAdmin} from './admin' import L10N from './l10n' import { generateUrl, @@ -52,6 +53,7 @@ export default { config: Config, dialogs: Dialogs, EventSource, + isUserAdmin, L10N, msg, Notification, diff --git a/core/src/globals.js b/core/src/globals.js index b84ef10d22b..9fcf03ba9ee 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -108,6 +108,7 @@ window['moment'] = moment window['OC'] = OC setDeprecatedProp('oc_config', OC.config, 'use OC.config instead') +setDeprecatedProp('oc_isadmin', OC.isUserAdmin(), 'use OC.isUserAdmin() instead') setDeprecatedProp('OCDialogs', OC.dialogs, 'use OC.dialogs instead') window['OCP'] = OCP window['OCA'] = OCA |