Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event required to indicate the creation of a new user #53

Closed
Arkusm opened this issue May 3, 2024 · 3 comments · Fixed by #58
Closed

Event required to indicate the creation of a new user #53

Arkusm opened this issue May 3, 2024 · 3 comments · Fixed by #58

Comments

@Arkusm
Copy link

Arkusm commented May 3, 2024

During the login process, an attempt is made to create a new user (plone member). I think that IUserAdderPlugin is used for this. Unfortunately no plone event is triggered in this context or I don't know which one. Even if the creation of the user was successful. Normally such an event is always triggered when a new user is created, like here.

My system uses a UsersAsContent implementation and I need such an event to create a new user object.

Can someone tell me if a corresponding event is triggered?

@erral
Copy link
Member

erral commented May 3, 2024

I tried to do so (#41) trying to log in the user in portal_membership tool, but I failed because the request is not yet authenticated.

@Arkusm
Copy link
Author

Arkusm commented May 3, 2024

You could trigger an event in plugins.py.

from Products.PluggableAuthService.events import PrincipalCreated
from zope.event import notify
...
notify(PrincipalCreated(user))  # line 218 befor break

This works. You can then create a subscriber this way

  <!-- New Member created -->
  <subscriber
      for="Products.PluggableAuthService.interfaces.authservice.IPropertiedUser
           Products.PluggableAuthService.interfaces.events.IPrincipalCreatedEvent"
      handler=".updater.new_user"
      />

But I don't know whether this is desired or should be done.

@erral
Copy link
Member

erral commented May 3, 2024

I think it is desired. It should be so, because there is a specific event for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants