This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal
Tuesday 20 May 2014 5:37:25 pm - 1 reply
Hi Community,
In my site, I use 2 content classes for the users :
When I log in to the site with a user of my custom classe, I get an error (TwigBundle:Exception:error500.html.twig).
I have no error when I connect with a user of the ezpublish class even id they are in the same group.
Is it possible to have several user content classes on eZ5 ?
Thanks,
Madeline
Friday 28 November 2014 11:33:23 am
Hello Madeline,
Hope this is not to late but I just stumbled on almost the same issue when trying to implement my custom UserProvider and AuthenticationProvider with my custom User class and after digging in eZCore I found that:
1. Even if you implement yout UserProvider and AuthenticationProvider and you modify the security.yml to use them, at the end you end up with a different type of user(userWrapped) and token
eZ\Publish\Core\MVC\Symfony\Security\UserWrapped
private 'wrappedUser' => ........../CustomUserBundle\Entity\User
This is accomplished by eZ by the SecurityListener, which listens to SecurityEvents::INTERACTIVE_LOGIN & KernelEvents::REQUEST event types, and creates a specific type of Token(InteractiveLoginToken) and UserWrapped
eZ\Publish\Core\MVC\Symfony\Security\EventListener/SecurityListener @ line 139
$interactiveToken = new InteractiveLoginToken( $this->getUser( $originalUser, $apiUser ), get_class( $token ), $token->getCredentials(), $providerKey, $token->getRoles() );
For me the problem was not overriding the login system and it's providers(I got the user logged in), but when I tried accessing the pages that used FormTypes where data_class was test to myCustomUserClass; as I was using getUser() to get the user from the session inside the controllers, I always ended up with that UserWrapped which (here it gets worse), does not allow you to access or retrieve the private wrappedUser object stored within;
So @ the moment I am trying to get in touch with an eZ expert and/or try to find a not ugly/ pretty is out of discussion, workaround
Modified on Friday 28 November 2014 11:51:51 am by Maior Valentin
You must be logged in to post messages in this topic!