I'll keep it short, I need to assign/add multiple users to the same project in Mantis (over 100+).
To create these accounts in bulk, I installed a plugin on the EC2 instance running Mantis (with the database installed directly on the same EC2) that allows importing a .csv list of users. That worked fine without any issues.
Now, I need to add all these users to the same project, and I was wondering if there's a way to do this in bulk.
While searching around, I only found that you can add multiple users by selecting them from the user list with CTRL, but they still need to be selected one by one.
I was thinking of creating an .sql script to run on the MySQL database to handle this directly, but I’m not even sure if that would work; plus, I’d prefer something slightly less "risky" or prone to errors.
Can anyone help? Thanks!
Ok, so in the end, I found this solution.
I don’t know if it’s the best, but it was the only one that came to mind and worked on the first try without causing too many issues.
awk '{print "INSERT INTO mantis-proj-userlist-table (project_id, user_id, access_level) SELECT project-id, id, 55 FROM users-table WHERE username = \x27" $1 "\x27;"}' user_list_file.csv > bulk_assign_project.sql
INSERT INTO user-project-association-table (project_id, user_id, access_level)
SELECT project-number, id, 55 FROM users-table WHERE username = 'actual-user-name';
mysql -u mantis_username -p database_name < bulk_assign_project.sql
SELECT filtering by the project ID.