ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 5 replies, has 2 voices, and was last updated by  cardiac 1 year, 2 months ago.

  • Creator
    Topic
  • #20819

    cardiac
    Participant

    Hi,

    I wanted to activate the symfony switch user implementation.

    security.yml

    But if I try to switch it I see an error:

    Fatal error: Call to undefined method

    Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken::getOrganizationContext() in /var/www/vhosts/orocrm/vendor/oro/platform/src/Oro/Bundle/DashboardBundle/Model/Manager.php on line 232

    I then found the ImpersonationToken which implements the OrganizationContextTokenInterface and should therefor work fine. But I haven’t found how to make use of it.

    Can you help me with the switch user case?

    Thanks and

    best regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #21107
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi,

    Unfortunately native orocrm doesn’t support this feature, because it uses Symfony SwitchUserListener, which uses UserPasswordToken, which doesn’t know about getOrganizationContext() function. Quite complicated. But i have created custom code, which allows use user switch. I didn’t test it enough, so use it as good example.

    #21108
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Here is my security.yml

    #21109
    Mike Kudelya
    Mike Kudelya
    Oro Core

    I had to copy the entire file because original SwitchUserListener.php too closed (many private properties)

    #21110
    Mike Kudelya
    Mike Kudelya
    Oro Core

    This is my custom UsernamePasswordOrganizationToken.php which is using by listener. I was thinking how to make it better and wrapped serialized data into base64, because i had some problems with || gluing in parent class.

    And last php file is token factory.

    service.yml

    #21121

    cardiac
    Participant

    Thank you Mike for the example. I will update here if I could use it.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.