Page 2 of 3

Re: Wondering the best way to mass-import users

Posted: 24 Jan 2019, 20:56
by mushu
Mantis 2.18.0
Windows Server 2012 R2

Re: Wondering the best way to mass-import users

Posted: 24 Jan 2019, 21:02
by cas
I only had errors eing reported hence I missed the notifcactions. Same time the import worked fine.
Is the import now running ok on your end?

Re: Wondering the best way to mass-import users

Posted: 24 Jan 2019, 22:37
by mushu
I will need some time to test it because I need to write the code to grab the employee data from active directory and stuff it into a csv flat file. but I can at least manually edit the sample csv file you supplied to test it I guess...will let you know.

Re: Wondering the best way to mass-import users

Posted: 30 Jan 2019, 22:01
by mushu
So I finally had time to code up a script to grab all users from our active directory forest and stuff it into a csv file in the proper format. I ran the latest version of your plugin and it seemed to work perfectly, skipping accounts that already exist. Yay! Thank you so much for this. Plus, it gives me a template to follow for when I begin to write new plugins. :-)

Only thing is, it sent an account creation notice to 1000+ users (oops) since I forgot that Mantis sends an email when an account is created. Plus, I ran this on DEV so I will need to run it on Production next, but figure out how to disable account cration emails--I hope it's just a global variable I can set in the config file...

Re: Wondering the best way to mass-import users

Posted: 31 Jan 2019, 12:23
by cas
setup mail to be send by cronjob and do not activate this. That can help :mrgreen:

Re: Wondering the best way to mass-import users

Posted: 31 Jan 2019, 16:38
by mushu
Well, this is on the Production site so I can't change how email is processed by Mantis. I will have to find a variable that prevents Mantis from sending out ANY emails, then import the users, then turn that variable back off so Mantis can continue to process emails. i hope it works, I already spammed 1000+ people without prior warning, don't want to do that again!

Re: Wondering the best way to mass-import users

Posted: 31 Jan 2019, 16:49
by atrol
There is option $g_enable_email_notification http://mantisbt.org/docs/master/en-US/A ... nfig.email

Re: Wondering the best way to mass-import users

Posted: 31 Jan 2019, 16:53
by mushu
Thanks for that. Unfortunately, I wanted it so it would not send the user an email notice that an account was created for them, and the variable you listed says it won't handle that.

So now my quest is to figure out how to create accounts without Mantis sending the customer an email. :-(

Re: Wondering the best way to mass-import users

Posted: 01 Feb 2019, 14:52
by cas
The best way is to adjust the plugin :D
Check out version 1.02 , now with an indicator in column 5 to send an email or not (1=send, 0= do not send).

Re: Wondering the best way to mass-import users

Posted: 01 Feb 2019, 16:21
by mushu
Thank you for the update! Before I run this, how does it actually prevent Mantis from sending a new-user-account email? I thought that was hard-coded in Mantis to always send an email when a new account is created...and no global variable exists to prevent it? I was going to just put in a fake SMTP server in config prior to running the plugin to ensure that no emails can be sent. I got pounded for the company-wide spam last time and don't want to get in trouble again. :-(

Re: Wondering the best way to mass-import users

Posted: 01 Feb 2019, 17:01
by cas
I created a copy of the default Mantis routine which would send out the email if a mail address existed. Now it checks the parameter from the inputfile expecting a valid email address in case you want to send an email.
For that check I will build one more check but for your activity this would be ok.
Please have a go and make a small test :mrgreen:

Re: Wondering the best way to mass-import users

Posted: 02 Feb 2019, 09:39
by cas
I have improved the chcek for sending emails ( or not) and adjusted the readme.
So have fun with version 1.03 :mrgreen:

Re: Wondering the best way to mass-import users

Posted: 04 Feb 2019, 19:18
by mushu
New version still did not declare variable in the _page.php file so I added it at the top like before, yet it crashes when I try to import the sample.csv file now. I get a server error 500. :-(

Re: Wondering the best way to mass-import users

Posted: 04 Feb 2019, 20:13
by cas
fixed both things in version 1.04.
Newer versions will be available via Github.
Currently on to 1.05 :mrgreen:

Re: Wondering the best way to mass-import users

Posted: 05 Feb 2019, 16:44
by mushu
Thank you for all your hard work, I just ran it and it imported the users without sending emails. Yay!

However, now Mantis won't process *any* emails. So I'm wondering what process you used to prevent sending emails, and if this would have interfered with the EmailReporting plugin in any way? I've uninstalled the import_users plugin but it still doesn't seem to process emails from the inbox. Thoughts?