Trying to keep some files up to date when new users and added, changed, etc. So, using a script in the section shown in the title.
So, I dumped the env from the script. Several issues here. For simple cases, all works fine. BUT, if in Virtualmin, I modify a user and CHANGE the email address (test to test2, admitedly the worst case scenario), I get these results in the env:
USERADMIN_OLD_USER=test2.onlineconsumerstore USERADMIN_OLD_PASS=steve USERADMIN_OLD_REAL=test USERADMIN_OLD_HOME=/home/onlineconsumerstore/homes/test2 USERADMIN_USER=test2.onlineconsumerstore USERADMIN_PASS=steve USERADMIN_REAL=test USERADMIN_HOME=/home/onlineconsumerstore/homes/test2
So, several problems here. USERADMIN_OLD_USER is the new user, not old. USERADMIN_REAL is the old user, not the new. USERADMIN_OLD_HOME in the new home dir, not the old. If I change them back, then, it gets even worse and there are different results. Try it.
I am needing to change a file based on these vars, that contain a lot of data, and, some of it can only be changed by knowing the correct old values. Based on the names, I presume they are supposed to work, so, bug report.
Separately, there is no variable with the domain name in it for the user. This is handy, I can capture it via:
domain=/usr/sbin/virtualmin list-users --all-domains --user $USERADMIN_USER --multiline | grep Domain:
domainname=echo $domain | cut -d ' ' -f2
But, it would be nice is the domain was simply provided to speed this up. But, since it's webmin, perhaps that is not possible since the change is made in Virtualmin, not sure. Or, is there a faster way to find the domain based on the user name? Or, is there another way to run an after email user created script?
Lastly, when creating a new user and USERADMIN_ACTION is set to CREATE_USER, and, using the after makign changes script still, the USERADMIN_HOME at the point in time the script is run! Makes it harder to put some files there with this script. My solution was to build the needed dir(s), but, perhaps this is also a bug? For me, after means, well, after!
Comments
Submitted by JamieCameron on Mon, 08/15/2011 - 16:25 Comment #1
Ok, I see the cause of this bug .. it's an error in Webmin, in which the USERADMIN_OLD_* variables are being set to the new user details! I will fix this in the next Webmin release.
Also, I will add a $USERADMIN_DOM variable so you can work out the domain name ..
Submitted by sfatula on Mon, 08/15/2011 - 16:58 Comment #2
What about the directory not being there for new users when the script is run. Will that stay the same, or, is that a bug also? See where I asked:
"Lastly, when creating a new user and USERADMIN_ACTION is set to CREATE_USER, and, using the after making changes script still, the USERADMIN_HOME at the point in time the script is run is not existing". So, USERADMIN_HOME points to a directory that is not yet created.
I corrected the mis-typed question here.
Submitted by JamieCameron on Mon, 08/15/2011 - 17:21 Comment #3
Sorry, I forgot to mention that this will be fixed as well in the next Virtualmin release (3.88)
Submitted by Issues on Mon, 08/29/2011 - 18:25 Comment #4
Automatically closed -- issue fixed for 2 weeks with no activity.