We need to have a procedure to give new users in the company a default set of Sametime groups to start chatting with their colleagues.
Because the contactlist is still in the OLD binay:data:base64 format, you cannot simply add users’ groups/contacts in a mongo-collection-way. You have to build the contactlist and decode it in BASE64 format. But there is also another way to do it.
I created a dummy user per department and logged in into Sametime as that user. I added all the default and department chat groups for those users. This created the default set in Sametime per department. Now I only have to create new documents in mongo userinfo-STORAGE collection. Works even when the user has not been logged in before yet.
How to get the BASH data from mongo?
Start mongosh
Type in:use userinfo
db.STORAGE.find( { userId: "CN=Dummy User Sales" } )
Response:
{
_id: ObjectId('6932f6597a85de2741a9310a'),
attrId: 0,
userId: 'CN=Dummy User Sales',
userData: Binary.createFromBase64('<here is the bash data>', 0)
}
You can now copy the value from userData into clipboard
Create a file \opt\mongosh\bin\groups-sales.js with the following code:
function copyStorageUsersFromCSV(csvPath) {
const userinfo = db.getSiblingDB('userinfo');
const base64String = "<copy value from clipboard over here>";
const binaryData = new BinData(0, base64String);
const csv = fs.readFileSync(csvPath, "utf8");
const lines = csv.split("\n").map(l => l.trim()).filter(l => l.length > 0);
// remove header
lines.shift();lines.forEach(userId => {
let username = userId;
print(`New: ${username}`);
// begin insert user
userinfo.STORAGE.insertOne({
userId : username,
attrId: 0,
userData: binaryData
})
// end insert user
});
} copyStorageUsersFromCSV("/data/new-user/users-sales.csv");
Userfile in csv extension
You now can create the file /data/new-user/users-sales.csv where all new users for the department sales are added:
userId
CN=User100,O=Company
CN=User101,O=Company
CN=User102,O=Company
CN=User103,O=company
To run this script, you have to open mongosh ( again )
type in: cd \data\new-user
mongosh
load("groups-sales.js")

Views: 4