Open ClausSchmidtPraxis opened 1 month ago
Hi @ClausSchmidtPraxis,
Sorry for this late answer.
You are very welcome and thanks for your kind words.
About your offer: I mostly maintain this plugin on my spare time and on my work time when there is something critical for our institution.
So, I had to check it firstly with by boss to just know if it can be assumed in our unit and this proposal seems reasonable. We can go on ;-)
Regarding the proposal you stated:
The motivation to my not fully agreement:
We have this plugin in our production site running once every night. I have to say that we often see that user A merges into user B, and then later on, user B merges into user A. It may seem a non-sense, but it happens so often. For instance, it depends on the documentation people present on different units of our institution (a University). A part from this, some of this weird cases were related to human errors introducing the new identification into the corporate systems with some incorrect characters.
I would like to have the funcionality you propose: "be easy to detect users bein merged and suspended by the plugin" so that we could later on delete them if necessary.
Let us explore another approach, if you like:
We have some of our local plugins (not contributed into Moodle Plugins) that on the install.php generates new user custom fields, and we often set them up to be visible only by managers and administrators.
What I propose you is something like:
If user deletion in your case may be an action that can be automated, it could also be possible to build a separate scheduled task to manage this, for instance, deleting users after X days/months/years of being suspended by the plugin. And this could be set up as a separate checkbox, disabled by default, so that administrators could think about it calmly.
How to detect that a user is suspended by the plugin: All conditions must apply:
I propose this automation since we have a rule of deleting inactive users, but this rule is very conservative, ensuring that the user was inactive the last 10 years. So, probably, other institutions may have similar automations for deleting users.
On the other hand, there are also the merging events in the logstore_standard_log, but just now I do not identify easily a proposal using just and only the logs (also, thinking about its performance). Also, the size of the logs may differ from institution to institution (every academic year a new database, keeping just last X days of logs, and so.
In summary:
Let me know your opinion.
Thanks,
Jordi
Hi Jordi
I would also like to apologize for my late reply. Thanks a lot for your response, by reading your considerations, I agree with you. We should not alter existing user data in Moodle, especially username! If we add the custom fields you propose, we will also avoid interfering with other functionality in Moodle.
Therefore, would you then consider accepting this implementation if we make a PR?
On install and next upgrade of the plugin, create a category "Merge User Info" with two user custom fields:
On successful merge (from user A to user B):
Regarding your proposal on automating deleting of merged and suspended users. We would like to consider that in a future PR.
Regards Claus
I like your proposal.
I think it is also good to separate things and evaluate automating deletion of users in the future, in a separate issue.
So, in the end, this issue would help to identify merged users, with the detail of the last merging. It is an important detail to be shown in the custom fields.
Thanks,
Jordi
I will notify our developers, that they can start working on it. We will get back with a pull request :-)
Claus
Hi @ClausSchmidtPraxis ,
Thanks for the feedback.
I am sharing with you some tips that you should consider while depeloping this part:
Thinking on it a bit, maybe, one easy way to fill in custom fields for user being kept and merged, would be implementing a event observer for the success event. It will decouple the merging operation with the filling operation afterwards, being easier to maintain. Just as an idea.
Thanks for the proposal and work,
Jordi
Hi Jordi, thanks for this great tool.
When managing users in Moodle, it can be difficult to identify users that were suspended by the merge users plugin. After succesfully merging several users, I might want to delete the "old users" suspended by the plugin, e.g. to avoid future conflicts and misunderstandings when having ambiguous accounts in Moodle. Therefore this change request is suggested:
In Plugin Settings
Add a [checkbox] enabling this:
Acceptance Criteria:
We are a Moodle Partner providing services for several organisations, and more of them are using your tool. We would like to contribute with this feature, if you would consider accepting this in a Pull Request from us.
Please let me know what you think.
Kind regards Claus