I don’t have the time to help with things that don’t exist in Mail-in-a-Box, and whether anyone else on this forum will volunteer their time for you is up to them.
There is a way, bear in mind that, this is not part of Mail-in-a-Box setup, you’ll have to make sure that you repeat steps 3(e) to 3(h) after a Mail-in-a-Box update.
Also, you’ll have to manually add new users to the company_A.sqlite database.
How to setup a master password:
Create the master password:
1(a). Run the following command:
doveadm pw -s SHA512-CRYPT
1(b). Save the hashed password for step 2(e).
Create a duplicate Sqlite database only for users from company A.
2(a). Start sqlite3:
sqlite3
2(b). Attach current users.sqlite database and the new company_A.sqlite database:
ATTACH '/home/user-data/mail/users.sqlite' AS DB1;
ATTACH '/home/user-data/mail/company_A.sqlite' AS DB2;
2(c). Create users table in DB2 database:
CREATE TABLE DB2.users (id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL UNIQUE, password TEXT NOT NULL, extra, privileges TEXT NOT NULL DEFAULT '');
2(d). Copy only users from company A to DB2 database:
INSERT INTO DB2.users SELECT * FROM DB1.users WHERE email LIKE '%@company_A.com';
2(e). Replace all users passwords with the master password:
UPDATE DB2.users SET password = 'Paste hashed password from step 1(a) here';
2(f). Exit sqlite:
.quit
2(g). Set owner to root:www-data for company_A.sqlite: