@@ -51,45 +51,45 @@ |
||
| 51 | 51 | use Psr\Container\ContainerInterface; |
| 52 | 52 | |
| 53 | 53 | class Application extends App implements IBootstrap { |
| 54 | - public function __construct(array $urlParams = []) { |
|
| 55 | - parent::__construct('provisioning_api', $urlParams); |
|
| 56 | - } |
|
| 54 | + public function __construct(array $urlParams = []) { |
|
| 55 | + parent::__construct('provisioning_api', $urlParams); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function register(IRegistrationContext $context): void { |
|
| 59 | - $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { |
|
| 60 | - return new NewUserMailHelper( |
|
| 61 | - $c->get(Defaults::class), |
|
| 62 | - $c->get(IURLGenerator::class), |
|
| 63 | - $c->get(IFactory::class), |
|
| 64 | - $c->get(IMailer::class), |
|
| 65 | - $c->get(ISecureRandom::class), |
|
| 66 | - $c->get(ITimeFactory::class), |
|
| 67 | - $c->get(IConfig::class), |
|
| 68 | - $c->get(ICrypto::class), |
|
| 69 | - Util::getDefaultEmailAddress('no-reply') |
|
| 70 | - ); |
|
| 71 | - }); |
|
| 72 | - $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { |
|
| 73 | - $user = $c->get(IUserManager::class)->get($c->get('UserId')); |
|
| 74 | - $isAdmin = false; |
|
| 75 | - $isSubAdmin = false; |
|
| 58 | + public function register(IRegistrationContext $context): void { |
|
| 59 | + $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { |
|
| 60 | + return new NewUserMailHelper( |
|
| 61 | + $c->get(Defaults::class), |
|
| 62 | + $c->get(IURLGenerator::class), |
|
| 63 | + $c->get(IFactory::class), |
|
| 64 | + $c->get(IMailer::class), |
|
| 65 | + $c->get(ISecureRandom::class), |
|
| 66 | + $c->get(ITimeFactory::class), |
|
| 67 | + $c->get(IConfig::class), |
|
| 68 | + $c->get(ICrypto::class), |
|
| 69 | + Util::getDefaultEmailAddress('no-reply') |
|
| 70 | + ); |
|
| 71 | + }); |
|
| 72 | + $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { |
|
| 73 | + $user = $c->get(IUserManager::class)->get($c->get('UserId')); |
|
| 74 | + $isAdmin = false; |
|
| 75 | + $isSubAdmin = false; |
|
| 76 | 76 | |
| 77 | - if ($user instanceof IUser) { |
|
| 78 | - $groupManager = $c->get(IGroupManager::class); |
|
| 79 | - assert($groupManager instanceof GroupManager); |
|
| 80 | - $isAdmin = $groupManager->isAdmin($user->getUID()); |
|
| 81 | - $isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user); |
|
| 82 | - } |
|
| 77 | + if ($user instanceof IUser) { |
|
| 78 | + $groupManager = $c->get(IGroupManager::class); |
|
| 79 | + assert($groupManager instanceof GroupManager); |
|
| 80 | + $isAdmin = $groupManager->isAdmin($user->getUID()); |
|
| 81 | + $isSubAdmin = $groupManager->getSubAdmin()->isSubAdmin($user); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - return new ProvisioningApiMiddleware( |
|
| 85 | - $c->get(IControllerMethodReflector::class), |
|
| 86 | - $isAdmin, |
|
| 87 | - $isSubAdmin |
|
| 88 | - ); |
|
| 89 | - }); |
|
| 90 | - $context->registerMiddleware(ProvisioningApiMiddleware::class); |
|
| 91 | - } |
|
| 84 | + return new ProvisioningApiMiddleware( |
|
| 85 | + $c->get(IControllerMethodReflector::class), |
|
| 86 | + $isAdmin, |
|
| 87 | + $isSubAdmin |
|
| 88 | + ); |
|
| 89 | + }); |
|
| 90 | + $context->registerMiddleware(ProvisioningApiMiddleware::class); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function boot(IBootContext $context): void { |
|
| 94 | - } |
|
| 93 | + public function boot(IBootContext $context): void { |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function register(IRegistrationContext $context): void { |
| 59 | - $context->registerService(NewUserMailHelper::class, function (ContainerInterface $c) { |
|
| 59 | + $context->registerService(NewUserMailHelper::class, function(ContainerInterface $c) { |
|
| 60 | 60 | return new NewUserMailHelper( |
| 61 | 61 | $c->get(Defaults::class), |
| 62 | 62 | $c->get(IURLGenerator::class), |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | Util::getDefaultEmailAddress('no-reply') |
| 70 | 70 | ); |
| 71 | 71 | }); |
| 72 | - $context->registerService(ProvisioningApiMiddleware::class, function (ContainerInterface $c) { |
|
| 72 | + $context->registerService(ProvisioningApiMiddleware::class, function(ContainerInterface $c) { |
|
| 73 | 73 | $user = $c->get(IUserManager::class)->get($c->get('UserId')); |
| 74 | 74 | $isAdmin = false; |
| 75 | 75 | $isSubAdmin = false; |