AppName); $dispatcher = $this->getContainer()->query(IEventDispatcher::class); # Adding the Pre-Logout-Event for logging a User out of Django when user is atempt to logout from the cloud $dispatcher->addServiceListener(BeforeUserLoggedOutEvent::class, LogoutByNC::class); # ADding the Event, that User has Changed - update the logged User by Django. Works only by personal informations of the User! $dispatcher->addServiceListener(UserChangedEvent::class, UserChangedByNC::class); } } /* CHANGED USER IN DJANGO BY NC */ class UserChangedByNC extends Controller { protected $session; protected $request; private $nclink = 'https://test.app.digitale-agentur.com'; public function __construct(string $AppName, IRequest $request, IUserSession $session) { $this->request = $request; parent::__construct($AppName, $request); $this->session = $session; } # Trigger in Django that the User changed public function handle(UserChangedEvent $event): void { $opts = [ "http" => [ "method" => "GET", "header" => "" ] ]; $context = stream_context_create($opts); $file = file_get_contents($this->nclink.'/api/uschanged/'.$this->session->getUser()->getUID().'/'.$this->request->getCookie('nc_session_id'), false, $context); } } /* LOGOUT DJANGO BY NC Diese Klasse wird erzeugt, wenn das Evenet BeforeUserLoggedOutEvent getriggert wird. Dann wird der User über die Django-API ausgeloggt! */ class LogoutByNC extends Controller { protected $session; private $nclink = 'https://test.app.digitale-agentur.com'; public function __construct(string $AppName, IRequest $request, IUserSession $session) { parent::__construct($AppName, $request); $this->session = $session; } # Logout the user! public function handle(BeforeUserLoggedOutEvent $event): void { $opts = [ "http" => [ "method" => "GET", "header" => "" ] ]; $context = stream_context_create($opts); $file = file_get_contents($this->nclink.'/api/logout/'.$this->session->getUser()->getUID(), false, $context); } }