Doctrine tries to persist virtual roles - inject roles to token instead of user

Description

Steps

Add a new workflow with at least one status and choose some groups for the first status

Exception

A new entity was found through the relationship 'Integrated\Bundle\UserBundle\Model\User#roles' that was not configured to cascade persist operations for entity: ID:
Role: ROLE_SCOPE_INTEGRATED
Hidden: FALSE
Label:
Description: . To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}).

Solution

Try to inject the ROLE_SCOPE_INTEGRATED to the token instead of the user.

Technical tasks

Inject ROLE_SCOPE_INTEGRATED to the token instead of the user

Deployment actions

None

Activity

Show:
Michael Jongman
June 27, 2018, 5:34 AM

, can you also review these two pull requests? Thanks in advance.

Koen Prins
June 27, 2018, 6:10 AM

Reviewed and approved, you can merge it.

Marijn Otte
June 27, 2018, 11:51 AM
Edited
  • ROLE_SCOPE_INTEGRATED is added twice

  • When I add a users without groups I am unable to login to the user

Ger Jan van den Bosch
June 28, 2018, 12:45 PM
Edited

https://symfony.com/doc/current/security.html#roles

Make sure every user has at least one role, or your user will look like they're not authenticated. A common convention is to give every user ROLE_USER.

Ger Jan van den Bosch
June 28, 2018, 1:03 PM

duplicate ROLE_SCOPE_INTEGRATED: the role ROLE_SCOPE_INTEGRATED was also in de the db

Assignee

Unassigned

External issue ID

None

Client

Integrated Marijn

Min. hours

8

Dev hour estimate

None

Epic Link

Sprint

None

Fix versions

Configure