atk4 / login

Add-on implementing User Login, Registration, Management and Password
https://agiletoolkit.org
MIT License
26 stars 22 forks source link

Cannot save adjusted User model #90

Closed mkrecek234 closed 2 years ago

mkrecek234 commented 2 years ago

Why? When the User model is being saved, also a $model->reload(); is initiated in https://github.com/atk4/data/blob/e6c0cf59e190bc0093d20719f380c781742cfde0/src/Persistence/Sql.php#L608

A reload means, that the current entity is first unloaded. This then leads upon the next verification of the Role model in GetRules in ACL to force a login: https://github.com/atk4/login/blob/35dfaf3dd56fb5c3e3273ac79abf958cec2c4367/src/Acl.php#L33 At this point, entity is no longer loaded, but entityId is present.

I assume we can skip to force login here?

mvorisek commented 2 years ago

I assume we can skip to force login here?

please propose a PR and let's see if all tests pass

mvorisek commented 2 years ago

@mkrecek234 the https://github.com/atk4/login/pull/92 PR you sent was traversing then on unloaded entity and newly such wrong usage of atk4/data throws, see https://github.com/atk4/login/pull/92#discussion_r814719089.

What is the current state of this issue and what result do you expect after a fix?