My big initial commit to this repo and project.

This commit is contained in:
Brian McGonagill 2022-08-05 16:55:56 -05:00
parent 750811a81f
commit 8636f8cf9b
2433 changed files with 199488 additions and 1042 deletions

View file

@ -4,8 +4,17 @@ import { check } from 'meteor/check';
Meteor.methods({
'addToRole' (role) {
console.log("User id for role: " + Meteor.userId() );
let userId = Meteor.userId();
Roles.addUsersToRoles(userId, role);
let countOfUsers = Meteor.users.find().count();
// if users = 1 - set to role passed in function call
if (countOfUsers > 1) {
console.log("User id for role: " + Meteor.userId() );
let userId = Meteor.userId();
Roles.addUsersToRoles(userId, role);
} else if (countOfUsers == 1) {
console.log("Creating first system admin user: " + Meteor.userId() );
let userId = Meteor.userId();
Roles.addUsersToRoles(userId, "systemadmin");
}
},
});