amazon web services - Addassign multiple users to a Mantis project - Stack Overflow

I'll keep it short, I need to assignadd multiple users to the same project in Mantis (over 100+).

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!

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!

Share Improve this question asked Feb 11 at 12:06 samsepiolsamsepiol 336 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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.

  1. I connected to the machine and created a .csv file, copying the list of usernames into a column.
  2. Then, I connected to the database and noted down the necessary details for the script:
    • The table containing the list of projects (and their respective IDs).
    • The table containing the list of users (and their respective IDs).
    • The name of the table that associates users with projects.
  3. Using awk, I generated the script with the info taken from the DB:
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
  • 55 in the command represents the Developer access level.

  1. Checking the generated file, it should contain the rows for each user, something like this:
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';
  1. Then I ran the script with:
mysql -u mantis_username -p database_name < bulk_assign_project.sql
  1. Finally, I connected to the DB to verify that the addition was successful using a simple SELECT filtering by the project ID.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745213103a4616960.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信