aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php4
-rw-r--r--lib/composer/composer/autoload_static.php4
-rw-r--r--lib/private/AppFramework/Bootstrap/RegistrationContext.php6
-rw-r--r--lib/private/Dashboard/Manager.php42
-rw-r--r--lib/private/legacy/OC_Util.php15
-rw-r--r--lib/public/AppFramework/Bootstrap/IRegistrationContext.php4
-rw-r--r--lib/public/Dashboard/IManager.php8
-rw-r--r--lib/public/Dashboard/IWidget.php (renamed from lib/public/Dashboard/IPanel.php)14
-rw-r--r--lib/public/Dashboard/RegisterWidgetEvent.php (renamed from lib/public/Dashboard/RegisterPanelEvent.php)6
9 files changed, 57 insertions, 46 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 5f61b848a83..0a64301f13b 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -170,13 +170,13 @@ return array(
'OCP\\Dashboard\\IDashboardManager' => $baseDir . '/lib/public/Dashboard/IDashboardManager.php',
'OCP\\Dashboard\\IDashboardWidget' => $baseDir . '/lib/public/Dashboard/IDashboardWidget.php',
'OCP\\Dashboard\\IManager' => $baseDir . '/lib/public/Dashboard/IManager.php',
- 'OCP\\Dashboard\\IPanel' => $baseDir . '/lib/public/Dashboard/IPanel.php',
+ 'OCP\\Dashboard\\IWidget' => $baseDir . '/lib/public/Dashboard/IWidget.php',
'OCP\\Dashboard\\Model\\IWidgetConfig' => $baseDir . '/lib/public/Dashboard/Model/IWidgetConfig.php',
'OCP\\Dashboard\\Model\\IWidgetRequest' => $baseDir . '/lib/public/Dashboard/Model/IWidgetRequest.php',
'OCP\\Dashboard\\Model\\WidgetSetting' => $baseDir . '/lib/public/Dashboard/Model/WidgetSetting.php',
'OCP\\Dashboard\\Model\\WidgetSetup' => $baseDir . '/lib/public/Dashboard/Model/WidgetSetup.php',
'OCP\\Dashboard\\Model\\WidgetTemplate' => $baseDir . '/lib/public/Dashboard/Model/WidgetTemplate.php',
- 'OCP\\Dashboard\\RegisterPanelEvent' => $baseDir . '/lib/public/Dashboard/RegisterPanelEvent.php',
+ 'OCP\\Dashboard\\RegisterWidgetEvent' => $baseDir . '/lib/public/Dashboard/RegisterWidgetEvent.php',
'OCP\\Dashboard\\Service\\IEventsService' => $baseDir . '/lib/public/Dashboard/Service/IEventsService.php',
'OCP\\Dashboard\\Service\\IWidgetsService' => $baseDir . '/lib/public/Dashboard/Service/IWidgetsService.php',
'OCP\\Defaults' => $baseDir . '/lib/public/Defaults.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index a37769e9ed6..43c45b2fe83 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -199,13 +199,13 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Dashboard\\IDashboardManager' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IDashboardManager.php',
'OCP\\Dashboard\\IDashboardWidget' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IDashboardWidget.php',
'OCP\\Dashboard\\IManager' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IManager.php',
- 'OCP\\Dashboard\\IPanel' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IPanel.php',
+ 'OCP\\Dashboard\\IWidget' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IWidget.php',
'OCP\\Dashboard\\Model\\IWidgetConfig' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/IWidgetConfig.php',
'OCP\\Dashboard\\Model\\IWidgetRequest' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/IWidgetRequest.php',
'OCP\\Dashboard\\Model\\WidgetSetting' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/WidgetSetting.php',
'OCP\\Dashboard\\Model\\WidgetSetup' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/WidgetSetup.php',
'OCP\\Dashboard\\Model\\WidgetTemplate' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/WidgetTemplate.php',
- 'OCP\\Dashboard\\RegisterPanelEvent' => __DIR__ . '/../../..' . '/lib/public/Dashboard/RegisterPanelEvent.php',
+ 'OCP\\Dashboard\\RegisterWidgetEvent' => __DIR__ . '/../../..' . '/lib/public/Dashboard/RegisterWidgetEvent.php',
'OCP\\Dashboard\\Service\\IEventsService' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Service/IEventsService.php',
'OCP\\Dashboard\\Service\\IWidgetsService' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Service/IWidgetsService.php',
'OCP\\Defaults' => __DIR__ . '/../../..' . '/lib/public/Defaults.php',
diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
index efcf9175b97..4c37209739e 100644
--- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php
+++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php
@@ -100,10 +100,10 @@ class RegistrationContext {
);
}
- public function registerDashboardPanel(string $panelClass): void {
+ public function registerDashboardWidget(string $widgetClass): void {
$this->context->registerDashboardPanel(
$this->appId,
- $panelClass
+ $widgetClass
);
}
@@ -282,7 +282,7 @@ class RegistrationContext {
public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void {
foreach ($this->dashboardPanels as $panel) {
try {
- $dashboardManager->lazyRegisterPanel($panel['class']);
+ $dashboardManager->lazyRegisterWidget($panel['class']);
} catch (Throwable $e) {
$appId = $panel['appId'];
$this->logger->logException($e, [
diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php
index 0c285a8b53d..fda4c8b3893 100644
--- a/lib/private/Dashboard/Manager.php
+++ b/lib/private/Dashboard/Manager.php
@@ -29,7 +29,7 @@ namespace OC\Dashboard;
use InvalidArgumentException;
use OCP\AppFramework\QueryException;
use OCP\Dashboard\IManager;
-use OCP\Dashboard\IPanel;
+use OCP\Dashboard\IWidget;
use OCP\ILogger;
use OCP\IServerContainer;
use Throwable;
@@ -37,10 +37,10 @@ use Throwable;
class Manager implements IManager {
/** @var array */
- private $lazyPanels = [];
+ private $lazyWidgets = [];
- /** @var IPanel[] */
- private $panels = [];
+ /** @var IWidget[] */
+ private $widgets = [];
/** @var IServerContainer */
private $serverContainer;
@@ -49,31 +49,31 @@ class Manager implements IManager {
$this->serverContainer = $serverContainer;
}
- private function registerPanel(IPanel $panel): void {
- if (array_key_exists($panel->getId(), $this->panels)) {
- throw new InvalidArgumentException('Dashboard panel with this id has already been registered');
+ private function registerWidget(IWidget $widget): void {
+ if (array_key_exists($widget->getId(), $this->widgets)) {
+ throw new InvalidArgumentException('Dashboard widget with this id has already been registered');
}
- $this->panels[$panel->getId()] = $panel;
+ $this->widgets[$widget->getId()] = $widget;
}
- public function lazyRegisterPanel(string $panelClass): void {
- $this->lazyPanels[] = $panelClass;
+ public function lazyRegisterWidget(string $widgetClass): void {
+ $this->lazyWidgets[] = $widgetClass;
}
public function loadLazyPanels(): void {
- $classes = $this->lazyPanels;
+ $classes = $this->lazyWidgets;
foreach ($classes as $class) {
try {
- /** @var IPanel $panel */
- $panel = $this->serverContainer->query($class);
+ /** @var IWidget $widget */
+ $widget = $this->serverContainer->query($class);
} catch (QueryException $e) {
/*
* There is a circular dependency between the logger and the registry, so
* we can not inject it. Thus the static call.
*/
\OC::$server->getLogger()->logException($e, [
- 'message' => 'Could not load lazy dashbaord panel: ' . $e->getMessage(),
+ 'message' => 'Could not load lazy dashbaord widget: ' . $e->getMessage(),
'level' => ILogger::FATAL,
]);
}
@@ -82,32 +82,32 @@ class Manager implements IManager {
* type, so we might get a TypeError here that we should catch.
*/
try {
- $this->registerPanel($panel);
+ $this->registerWidget($widget);
} catch (Throwable $e) {
/*
* There is a circular dependency between the logger and the registry, so
* we can not inject it. Thus the static call.
*/
\OC::$server->getLogger()->logException($e, [
- 'message' => 'Could not register lazy dashboard panel: ' . $e->getMessage(),
+ 'message' => 'Could not register lazy dashboard widget: ' . $e->getMessage(),
'level' => ILogger::FATAL,
]);
}
try {
- $panel->load();
+ $widget->load();
} catch (Throwable $e) {
\OC::$server->getLogger()->logException($e, [
- 'message' => 'Error during dashboard panel loading: ' . $e->getMessage(),
+ 'message' => 'Error during dashboard widget loading: ' . $e->getMessage(),
'level' => ILogger::FATAL,
]);
}
}
- $this->lazyPanels = [];
+ $this->lazyWidgets = [];
}
- public function getPanels(): array {
+ public function getWidgets(): array {
$this->loadLazyPanels();
- return $this->panels;
+ return $this->widgets;
}
}
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 82b7abf6c8f..ab386ab6172 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -68,6 +68,7 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUser;
+use OCP\IUserSession;
class OC_Util {
public static $scripts = [];
@@ -1088,6 +1089,8 @@ class OC_Util {
* @suppress PhanDeprecatedFunction
*/
public static function getDefaultPageUrl() {
+ /** @var IConfig $config */
+ $config = \OC::$server->get(IConfig::class);
$urlGenerator = \OC::$server->getURLGenerator();
// Deny the redirect if the URL contains a @
// This prevents unvalidated redirects like ?redirect_url=:user@domain.com
@@ -1099,8 +1102,16 @@ class OC_Util {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
$appId = 'files';
- $config = \OC::$server->getConfig();
- $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'files'));
+ $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'dashboard,files'));
+
+ /** @var IUserSession $userSession */
+ $userSession = \OC::$server->get(IUserSession::class);
+ $user = $userSession->getUser();
+ if ($user) {
+ $userDefaultApps = explode(',', $config->getUserValue($user->getUID(), 'core', 'defaultapp'));
+ $defaultApps = array_filter(array_merge($userDefaultApps, $defaultApps));
+ }
+
// find the first app that is enabled for the current user
foreach ($defaultApps as $defaultApp) {
$defaultApp = OC_App::cleanAppId(strip_tags($defaultApp));
diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
index 94e3aed17e2..0acf0c038bb 100644
--- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
+++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php
@@ -59,11 +59,11 @@ interface IRegistrationContext {
* Register an implementation of \OCP\Dashboard\IPanel that
* will handle the implementation of a dashboard panel
*
- * @param string $panelClass
+ * @param string $widgetClass
* @return void
* @since 20.0.0
*/
- public function registerDashboardPanel(string $panelClass): void;
+ public function registerDashboardWidget(string $widgetClass): void;
/**
* Register a service
*
diff --git a/lib/public/Dashboard/IManager.php b/lib/public/Dashboard/IManager.php
index 985c8c7838f..81b1bb0dffe 100644
--- a/lib/public/Dashboard/IManager.php
+++ b/lib/public/Dashboard/IManager.php
@@ -35,15 +35,15 @@ namespace OCP\Dashboard;
interface IManager {
/**
- * @param string $panelClass
+ * @param string $widgetClass
* @since 20.0.0
*/
- public function lazyRegisterPanel(string $panelClass): void;
+ public function lazyRegisterWidget(string $widgetClass): void;
/**
* @since 20.0.0
*
- * @return IPanel[]
+ * @return IWidget[]
*/
- public function getPanels(): array;
+ public function getWidgets(): array;
}
diff --git a/lib/public/Dashboard/IPanel.php b/lib/public/Dashboard/IWidget.php
index 59d88f7a7e9..42e2c7df5b2 100644
--- a/lib/public/Dashboard/IPanel.php
+++ b/lib/public/Dashboard/IWidget.php
@@ -27,33 +27,33 @@ declare(strict_types=1);
namespace OCP\Dashboard;
/**
- * Interface IPanel
+ * Interface IWidget
*
* @package OCP\Dashboard
* @since 20.0.0
*/
-interface IPanel {
+interface IWidget {
/**
- * @return string Unique id that identifies the panel, e.g. the app id
+ * @return string Unique id that identifies the widget, e.g. the app id
* @since 20.0.0
*/
public function getId(): string;
/**
- * @return string User facing title of the panel
+ * @return string User facing title of the widget
* @since 20.0.0
*/
public function getTitle(): string;
/**
- * @return int Initial order for panel sorting
+ * @return int Initial order for widget sorting
* @since 20.0.0
*/
public function getOrder(): int;
/**
- * @return string css class that displays an icon next to the panel title
+ * @return string css class that displays an icon next to the widget title
* @since 20.0.0
*/
public function getIconClass(): string;
@@ -65,7 +65,7 @@ interface IPanel {
public function getUrl(): ?string;
/**
- * Execute panel bootstrap code like loading scripts and providing initial state
+ * Execute widget bootstrap code like loading scripts and providing initial state
* @since 20.0.0
*/
public function load(): void;
diff --git a/lib/public/Dashboard/RegisterPanelEvent.php b/lib/public/Dashboard/RegisterWidgetEvent.php
index 2bd157127fd..0267a9e0d36 100644
--- a/lib/public/Dashboard/RegisterPanelEvent.php
+++ b/lib/public/Dashboard/RegisterWidgetEvent.php
@@ -40,7 +40,7 @@ use OCP\EventDispatcher\Event;
* @since 20.0.0
* @deprecated 20.0.0
*/
-class RegisterPanelEvent extends Event {
+class RegisterWidgetEvent extends Event {
private $manager;
public function __construct(IManager $manager) {
@@ -53,7 +53,7 @@ class RegisterPanelEvent extends Event {
* @param string $panelClass
* @since 20.0.0
*/
- public function registerPanel(string $panelClass) {
- $this->manager->lazyRegisterPanel($panelClass);
+ public function registerWidget(string $panelClass) {
+ $this->manager->lazyRegisterWidget($panelClass);
}
}