eZ trouble shooting: Login into the new stack from the legacy stack

24 Aug

eZ Systems changed the way how logins are handled a few versions ago (versions > 5.3).

If your application still uses the legacy stack and you are using your own login module in the old stack you might have a problem: the new eZ (and Symfony) version will not login the user on the Symfony stack.

If you want to login a user in the new stack as well as in the legacy stack this solution in eZ 4 might help:

 $userId =  = 1224;
 $container = ezpKernel::instance()->getServiceContainer();
 try {
      
     $repository = $container->get('ezpublish.api.repository');
     $userService = $repository->getUserService();
     $ezUser = $userService->loadUser($userId);
     if ($ezUser) {
            $user = new CoreUser($ezUser);
            $providerKey = 'ezpublish_front';
            $token = new UsernamePasswordToken($user, null, $providerKey);

            $securityContextService = $container->get('security.context');
            $securityContextService->setToken($token);

            $repository->setCurrentUser($ezUser);
    } else {
            eZDebug::writeError('User with id '.$userId.' in new stack not found, login falied',__METHOD__);
    }
} catch (\Exception $e) {
     eZDebug::writeError("Exception while trying to login on new stack: ". $e->getMessage());
 }

eZ Publish 5: Custom tags with Symfony services

13 Feb

How to render a custom tag for XML Text using your Symfony services and templates

One of my favorite features of eZ Publish is the ability to create nice-looking content with various nicely formatted blocks. That makes reading more interesting for the user. Due to storing content as XML it is possible to present information however you want. Along with a big number of standard tags like paragraph, image or table you are free to create your own custom tags: an embedded YouTube video, Google Maps, a sllideshare presentation, a source code block with syntax highlighting, QR-code etc. This article will show you how to use Symfony services to render custom tags.

Continue reading “eZ Publish 5: Custom tags with Symfony services” »

Extend eZ 5.3 – Change user authentication to login with email

11 Jul

Sometimes it is required that a user needs to be logged in additionally via email address, not only via username. In eZ Publish prior to version 5.3 this was possible since eZ provided legacy settings (site.ini) for it:

[UserSettings]
AuthenticateMatch=login;email

Starting with eZ 5.3 the logic has been changed and eZ Publish is now using the security feature of Symfony. This means a login with the email address isn´t possible anymore and eZ will use the login only.  The new version seems to ignore the settings defined in „AuthenticateMatch“.

If you want to allow this functionality, there are two things that you need to do:

Continue reading “Extend eZ 5.3 – Change user authentication to login with email” »

Operator in PHP nutzen

3 Mai
Reproduktion in: Mix & Genest (Hsg.), 75 Jahre Mix & Genest, 1879-1954, E.Klett Stuttgart, o.J.

Reproduktion in: Mix & Genest (Hsg.), 75 Jahre Mix & Genest, 1879-1954, E.Klett Stuttgart, o.J.

Was würden wir nur ohne einen „Operator“ machen? Ohne dieses kleine Hilfsmittel würde wahrscheinlich keine eZ Publish Seite funktionieren. Wahrscheinlich? Nein, ganz sicher nicht. Oft werden sie nur in Templates benutzt, ob jetzt Twig oder eZ Template. Doch was ist, wenn man auf einen Operator auch mal über PHP zugreifen möchte?

Continue reading “Operator in PHP nutzen” »

eZ Publish Update ab > 4.4

19 Mrz

Ich habe in den letzten Wochen einige Projekte von 4.4/4.5 auf 4.7 aktualisiert, dabei bin ich leider immer über den selben Fehler gestolpert.

Und zwar waren die Tabs von den Usern sichtbar, aber die Inhalte unterhalb konnte man nicht sehen. In der Update Anleitung von eZ steht eigentlich, was genau zu tun ist. Doch aus irgendeinem Grund habe ich die Anleitung falsch interpretiert. Hier jetzt also die Aufklärung 🙂

Continue reading “eZ Publish Update ab > 4.4” »