3434use OCA \Provisioning_API \Middleware \ProvisioningApiMiddleware ;
3535use OCA \Settings \Mailer \NewUserMailHelper ;
3636use OCP \AppFramework \App ;
37+ use OCP \AppFramework \Bootstrap \IBootContext ;
38+ use OCP \AppFramework \Bootstrap \IBootstrap ;
39+ use OCP \AppFramework \Bootstrap \IRegistrationContext ;
3740use OCP \AppFramework \Utility \IControllerMethodReflector ;
3841use OCP \Defaults ;
3942use OCP \IGroupManager ;
4043use OCP \IUser ;
4144use OCP \Util ;
4245
43- class Application extends App {
46+ class Application extends App implements IBootstrap {
4447 public function __construct (array $ urlParams = []) {
4548 parent ::__construct ('provisioning_api ' , $ urlParams );
49+ }
4650
47- $ container = $ this -> getContainer ();
48- $ server = $ container ->getServer ();
51+ public function register ( IRegistrationContext $ context ): void {
52+ $ server = $ this -> getContainer () ->getServer ();
4953
50- $ container ->registerService (NewUserMailHelper::class, function (SimpleContainer $ c ) use ($ server ) {
54+ $ context ->registerService (NewUserMailHelper::class, function (SimpleContainer $ c ) use ($ server ) {
5155 return new NewUserMailHelper (
5256 $ server ->query (Defaults::class),
5357 $ server ->getURLGenerator (),
@@ -60,7 +64,7 @@ public function __construct(array $urlParams = []) {
6064 Util::getDefaultEmailAddress ('no-reply ' )
6165 );
6266 });
63- $ container ->registerService (' ProvisioningApiMiddleware ' , function (SimpleContainer $ c ) use ($ server ) {
67+ $ context ->registerService (ProvisioningApiMiddleware::class , function (SimpleContainer $ c ) use ($ server ) {
6468 $ user = $ server ->getUserManager ()->get ($ c ['UserId ' ]);
6569 $ isAdmin = false ;
6670 $ isSubAdmin = false ;
@@ -78,6 +82,11 @@ public function __construct(array $urlParams = []) {
7882 $ isSubAdmin
7983 );
8084 });
81- $ container ->registerMiddleWare ('ProvisioningApiMiddleware ' );
85+ $ context ->registerMiddleware (ProvisioningApiMiddleware::class);
86+ }
87+
88+ public function boot (IBootContext $ context ): void {
8289 }
90+
91+
8392}
0 commit comments