summaryrefslogtreecommitdiffstats
path: root/lib/private/Template
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-12-01 10:36:13 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-02-27 12:29:25 +0100
commit7d0102bf7302a483209e0d1c926260713f0e56c6 (patch)
treea6286d8dcb2748f062fa00d21a92a6e58e46b917 /lib/private/Template
parentd0a6368a8bc9b03cba66c4a485aa001da187b2e3 (diff)
downloadnextcloud-server-7d0102bf7302a483209e0d1c926260713f0e56c6.tar.gz
nextcloud-server-7d0102bf7302a483209e0d1c926260713f0e56c6.zip
expose capabilities in js
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/private/Template')
-rw-r--r--lib/private/Template/JSConfigHelper.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php
index b8bff074200..b691a8a64cb 100644
--- a/lib/private/Template/JSConfigHelper.php
+++ b/lib/private/Template/JSConfigHelper.php
@@ -28,6 +28,7 @@
namespace OC\Template;
use bantu\IniGetWrapper\IniGetWrapper;
+use OC\CapabilitiesManager;
use OCP\App\IAppManager;
use OCP\Defaults;
use OCP\IConfig;
@@ -66,6 +67,9 @@ class JSConfigHelper {
/** @var IURLGenerator */
private $urlGenerator;
+ /** @var CapabilitiesManager */
+ private $capabilitiesManager;
+
/**
* @param IL10N $l
* @param Defaults $defaults
@@ -76,6 +80,7 @@ class JSConfigHelper {
* @param IGroupManager $groupManager
* @param IniGetWrapper $iniWrapper
* @param IURLGenerator $urlGenerator
+ * @param CapabilitiesManager $capabilitiesManager
*/
public function __construct(IL10N $l,
Defaults $defaults,
@@ -85,7 +90,8 @@ class JSConfigHelper {
IConfig $config,
IGroupManager $groupManager,
IniGetWrapper $iniWrapper,
- IURLGenerator $urlGenerator) {
+ IURLGenerator $urlGenerator,
+ CapabilitiesManager $capabilitiesManager) {
$this->l = $l;
$this->defaults = $defaults;
$this->appManager = $appManager;
@@ -95,6 +101,7 @@ class JSConfigHelper {
$this->groupManager = $groupManager;
$this->iniWrapper = $iniWrapper;
$this->urlGenerator = $urlGenerator;
+ $this->capabilitiesManager = $capabilitiesManager;
}
public function getConfig() {
@@ -146,6 +153,8 @@ class JSConfigHelper {
$lastConfirmTimestamp = 0;
}
+ $capabilities = $this->capabilitiesManager->getCapabilities();
+
$array = [
"oc_debug" => $this->config->getSystemValue('debug', false) ? 'true' : 'false',
"oc_isadmin" => $this->groupManager->isAdmin($uid) ? 'true' : 'false',
@@ -252,6 +261,7 @@ class JSConfigHelper {
'longFooter' => $this->defaults->getLongFooter(),
'folder' => \OC_Util::getTheme(),
]),
+ "oc_capabilities" => json_encode($capabilities),
];
if ($this->currentUser !== null) {