diff options
author | Christopher Ng <chrng8@gmail.com> | 2021-10-14 08:19:40 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2021-10-19 04:59:35 +0000 |
commit | 309354852f12ae88d5eef05d311d6ebcba8ee762 (patch) | |
tree | 640c4e2394ba2a868d8d1cb6b5271fd1271bbdab /lib/private/AppFramework/Bootstrap | |
parent | 7215148a242815a5064ce5d00a387c634dc936f3 (diff) | |
download | nextcloud-server-309354852f12ae88d5eef05d311d6ebcba8ee762.tar.gz nextcloud-server-309354852f12ae88d5eef05d311d6ebcba8ee762.zip |
Profile backend
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private/AppFramework/Bootstrap')
-rw-r--r-- | lib/private/AppFramework/Bootstrap/Coordinator.php | 21 | ||||
-rw-r--r-- | lib/private/AppFramework/Bootstrap/RegistrationContext.php | 28 |
2 files changed, 39 insertions, 10 deletions
diff --git a/lib/private/AppFramework/Bootstrap/Coordinator.php b/lib/private/AppFramework/Bootstrap/Coordinator.php index 8ffe54a2575..6e05b7fdc88 100644 --- a/lib/private/AppFramework/Bootstrap/Coordinator.php +++ b/lib/private/AppFramework/Bootstrap/Coordinator.php @@ -27,10 +27,14 @@ declare(strict_types=1); * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ + namespace OC\AppFramework\Bootstrap; -use OC\Support\CrashReport\Registry; +use function class_exists; +use function class_implements; +use function in_array; use OC_App; +use OC\Support\CrashReport\Registry; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\QueryException; @@ -39,9 +43,6 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\IServerContainer; use Psr\Log\LoggerInterface; use Throwable; -use function class_exists; -use function class_implements; -use function in_array; class Coordinator { @@ -66,11 +67,13 @@ class Coordinator { /** @var string[] */ private $bootedApps = []; - public function __construct(IServerContainer $container, - Registry $registry, - IManager $dashboardManager, - IEventDispatcher $eventListener, - LoggerInterface $logger) { + public function __construct( + IServerContainer $container, + Registry $registry, + IManager $dashboardManager, + IEventDispatcher $eventListener, + LoggerInterface $logger + ) { $this->serverContainer = $container; $this->registry = $registry; $this->dashboardManager = $dashboardManager; diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index 8eed6a5bde4..c638af94c84 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -26,9 +26,11 @@ declare(strict_types=1); * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ + namespace OC\AppFramework\Bootstrap; use Closure; +use function array_shift; use OC\Support\CrashReport\Registry; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IRegistrationContext; @@ -43,11 +45,11 @@ use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Template\ICustomTemplateProvider; use OCP\Http\WellKnown\IHandler; use OCP\Notification\INotifier; +use OCP\Profile\ILinkAction; use OCP\Search\IProvider; use OCP\Support\CrashReport\IReporter; use Psr\Log\LoggerInterface; use Throwable; -use function array_shift; class RegistrationContext { @@ -60,6 +62,9 @@ class RegistrationContext { /** @var ServiceRegistration<IWidget>[] */ private $dashboardPanels = []; + /** @var ServiceRegistration<ILinkAction>[] */ + private $profileActions = []; + /** @var ServiceFactoryRegistration[] */ private $services = []; @@ -236,6 +241,13 @@ class RegistrationContext { $class ); } + + public function registerProfileAction(string $actionClass): void { + $this->context->registerProfileAction( + $this->appId, + $actionClass + ); + } }; } @@ -316,6 +328,13 @@ class RegistrationContext { } /** + * @psalm-param class-string<ILinkAction> $capability + */ + public function registerProfileAction(string $appId, string $actionClass): void { + $this->profileActions[] = new ServiceRegistration($appId, $actionClass); + } + + /** * @param App[] $apps */ public function delegateCapabilityRegistrations(array $apps): void { @@ -552,4 +571,11 @@ class RegistrationContext { public function getCalendarProviders(): array { return $this->calendarProviders; } + + /** + * @return ServiceRegistration<ILinkAction>[] + */ + public function getProfileActions(): array { + return $this->profileActions; + } } |