Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-01-10 11:59:57 +0300
committerGitHub <noreply@github.com>2017-01-10 11:59:57 +0300
commit90c5912eec028b1019a899de15b270a6a18ea823 (patch)
treebcb4abfbe36f53521769e6da269784f79c619166
parent97788f15330c06e067d9cd9c390e17a24191e0ce (diff)
parentf5310c0c26322b736e8d67399501b11ff299ea11 (diff)
Merge pull request #2980 from nextcloud/backport-2930-kill-group-restriction-when-not-applicablev11.0.1RC1
[stable11] Remove group restrictions when those are not allowed anymore
-rw-r--r--lib/private/App/AppManager.php15
-rw-r--r--lib/private/legacy/app.php8
-rw-r--r--lib/public/App/IAppManager.php9
3 files changed, 32 insertions, 0 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index fca5c9b87ac..6b819ef7ac1 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -221,6 +221,21 @@ class AppManager implements IAppManager {
}
/**
+ * Whether a list of types contains a protected app type
+ *
+ * @param string[] $types
+ * @return bool
+ */
+ public function hasProtectedAppType($types) {
+ if (empty($types)) {
+ return false;
+ }
+
+ $protectedTypes = array_intersect($this->protectedAppTypes, $types);
+ return !empty($protectedTypes);
+ }
+
+ /**
* Enable an app only for specific groups
*
* @param string $appId
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index adf29601ac6..8ef7e08c733 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -273,9 +273,17 @@ class OC_App {
$appTypes = implode(',', $appData['types']);
} else {
$appTypes = '';
+ $appData['types'] = [];
}
\OC::$server->getAppConfig()->setValue($app, 'types', $appTypes);
+
+ if (\OC::$server->getAppManager()->hasProtectedAppType($appData['types'])) {
+ $enabled = \OC::$server->getAppConfig()->getValue($app, 'enabled', 'yes');
+ if ($enabled !== 'yes' && $enabled !== 'no') {
+ \OC::$server->getAppConfig()->setValue($app, 'enabled', 'yes');
+ }
+ }
}
/**
diff --git a/lib/public/App/IAppManager.php b/lib/public/App/IAppManager.php
index 057a964ce0a..72c99777124 100644
--- a/lib/public/App/IAppManager.php
+++ b/lib/public/App/IAppManager.php
@@ -62,6 +62,15 @@ interface IAppManager {
public function enableApp($appId);
/**
+ * Whether a list of types contains a protected app type
+ *
+ * @param string[] $types
+ * @return bool
+ * @since 12.0.0
+ */
+ public function hasProtectedAppType($types);
+
+ /**
* Enable an app only for specific groups
*
* @param string $appId