Started adding async calls for upgrading to Meteor 3.0. Numerous other fixes.

This commit is contained in:
2025-07-02 11:18:09 -07:00
parent e1216741d6
commit 2e99ad007c
32 changed files with 549 additions and 373 deletions

View File

@@ -1,11 +1,21 @@
import { Roles } from 'meteor/alanning:roles'
if(Meteor.isServer) {
Meteor.publish('roles', function() {
//console.log("Checking if user is in the manage role: " + Meteor.userId() + " === " + Roles.userIsInRole(this.userId, ['manage']))
if(Roles.userIsInRole(this.userId, ['manage'])) {
return Meteor.roles.find({}, {fields: {name: 1}});
//Meteor.roles.find({}, {fields: {name: 1}}).fetchAsync().then(roles => {console.log(roles)})
//return Meteor.roles.find({}, {fields: {name: 1}});
return Meteor.roles.find({});
}
else throw new Meteor.Error(403, "Not authorized to view roles.");
});
Meteor.publish("roleAssignments", function() {
if(Roles.userIsInRole(this.userId, ['manage'])) {
return Meteor.roleAssignment.find({});
}
else throw new Meteor.Error(403, "Not authorized to view roles.");
})
}
let ROLE_MANAGE = "manage";
@@ -13,5 +23,12 @@ let ROLE_UPDATE = "update";
Meteor.UserRoles = {ROLE_MANAGE, ROLE_UPDATE};
// This is the collection that maps users to roles (v3 of alanning:roles).
//Meteor.roleAssignment
// This is where you will find the roles defained in MongoDB:
//Meteor.roles
Roles.createRoleAsync(ROLE_MANAGE)
Roles.createRoleAsync(ROLE_UPDATE)
export default Meteor.roles;