summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-03-10 12:20:45 +0100
committerJoas Schilling <coding@schilljs.com>2021-03-10 13:02:08 +0100
commita1e5090b3f8592a1d5facd953cc98a886dc02d7e (patch)
tree11069f95c7472d2b91256fc9d4be968b237be9d0
parente5b1d59dfd7bbc723586ae0ffeec9628fb6281be (diff)
downloadnextcloud-server-a1e5090b3f8592a1d5facd953cc98a886dc02d7e.tar.gz
nextcloud-server-a1e5090b3f8592a1d5facd953cc98a886dc02d7e.zip
Fix some psalm warnings
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/provisioning_api/lib/AppInfo/Application.php39
1 files changed, 22 insertions, 17 deletions
diff --git a/apps/provisioning_api/lib/AppInfo/Application.php b/apps/provisioning_api/lib/AppInfo/Application.php
index de9d91e0b6b..863f8861d8b 100644
--- a/apps/provisioning_api/lib/AppInfo/Application.php
+++ b/apps/provisioning_api/lib/AppInfo/Application.php
@@ -28,8 +28,6 @@
namespace OCA\Provisioning_API\AppInfo;
-use OC\AppFramework\Utility\SimpleContainer;
-use OC\AppFramework\Utility\TimeFactory;
use OC\Group\Manager as GroupManager;
use OCA\Provisioning_API\Middleware\ProvisioningApiMiddleware;
use OCA\Settings\Mailer\NewUserMailHelper;
@@ -38,10 +36,19 @@ use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Utility\IControllerMethodReflector;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Defaults;
+use OCP\IConfig;
use OCP\IGroupManager;
+use OCP\IURLGenerator;
use OCP\IUser;
+use OCP\IUserManager;
+use OCP\L10N\IFactory;
+use OCP\Mail\IMailer;
+use OCP\Security\ICrypto;
+use OCP\Security\ISecureRandom;
use OCP\Util;
+use Psr\Container\ContainerInterface;
class Application extends App implements IBootstrap {
public function __construct(array $urlParams = []) {
@@ -49,35 +56,33 @@ class Application extends App implements IBootstrap {
}
public function register(IRegistrationContext $context): void {
- $server = $this->getContainer()->getServer();
-
- $context->registerService(NewUserMailHelper::class, function (SimpleContainer $c) use ($server) {
+ $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) {
return new NewUserMailHelper(
- $server->query(Defaults::class),
- $server->getURLGenerator(),
- $server->getL10NFactory(),
- $server->getMailer(),
- $server->getSecureRandom(),
- new TimeFactory(),
- $server->getConfig(),
- $server->getCrypto(),
+ $c->get(Defaults::class),
+ $c->get(IURLGenerator::class),
+ $c->get(IFactory::class),
+ $c->get(IMailer::class),
+ $c->get(ISecureRandom::class),
+ $c->get(ITimeFactory::class),
+ $c->get(IConfig::class),
+ $c->get(ICrypto::class),
Util::getDefaultEmailAddress('no-reply')
);
});
- $context->registerService(ProvisioningApiMiddleware::class, function (SimpleContainer $c) use ($server) {
- $user = $server->getUserManager()->get($c['UserId']);
+ $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) {
+ $user = $c->get(IUserManager::class)->get($c->get('UserId'));
$isAdmin = false;
$isSubAdmin = false;
if ($user instanceof IUser) {
- $groupManager = $server->get(IGroupManager::class);
+ $groupManager = $c->get(IGroupManager::class);
assert($groupManager instanceof GroupManager);
$isAdmin = $groupManager->isAdmin($user->getUID());
$isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user);
}
return new ProvisioningApiMiddleware(
- $c->query(IControllerMethodReflector::class),
+ $c->get(IControllerMethodReflector::class),
$isAdmin,
$isSubAdmin
);