Filtering user change events
Is there a way to determine what triggered a user change event? For instance, I would like to be able to only do something when a specific change is made to a user and ignore all other changes. I can't seem to find anything exposed that would allow me to do something like that. The code below is a sample of what I have with a TODO of what I am wanting to add.
public class MyListener implements UserModelListener { private final SBuildServer myBuildServer; public MyListener(SBuildServer sBuildServer) { myBuildServer = sBuildServer; } public void register(){ myBuildServer.getUserModel().addListener(this); } public void userAccountCreated(@NotNull User user) {
// do nothing
} public void userAccountChanged(User user) { Loggers.SERVER.info("User " + user.getName() + " changed.");
// TODO: only do something if the e-mail address changed. } public void userAccountRemoved(User user) { // do nothing } }
Please sign in to leave a comment.
Unfortunately no. As a workaround, upon plugin initialization you can remember names for all of the users and when userAccountChanges event occurs compare old name and new one.
Bummer, I figured that was the case. Ok thanks for confirming this.
Do you mind if I add a feature request for this in YouTrack? It isn't something I really need but it would be nice to have more information about the user changes that are occurring in the events.
Feel free to submit feature request. I find this feature useful too.