$this->clearAppsCache();
}
+ /**
+ * 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
*
$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');
+ }
+ }
}
/**
*/
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
*