Meteor-Community-Packages / meteor-roles

Authorization package for Meteor, compatible with built-in accounts packages
http://meteor-community-packages.github.io/meteor-roles/
MIT License
920 stars 167 forks source link

TypeError: Package.alanning:roles.Roles._forwardMigrate is not a function #315

Closed Ajaay closed 4 years ago

Ajaay commented 4 years ago

Hi,

Trying to upgrade from v1 to v2 but the forwardMigrate function does not appear to be available and gives me this error:

Package['alanning:roles'].Roles._forwardMigrate() TypeError: Package.alanning:roles.Roles._forwardMigrate is not a function at evalCommandPromise.then (packages/shell-server/shell-server.js:249:21) at runBound (domain.js:314:12) at bound (domain.js:301:14) at defaultEval (repl.js:240:29) at ContextifyScript.Script.runInThisContext (vm.js:50:33) at repl:1:-29

Here's what looks to be available:

Package['alanning:roles'].Roles { GLOBAL_GROUP: '__global_roles__', createRole: [Function: createRole], deleteRole: [Function: deleteRole], addUsersToRoles: [Function: addUsersToRoles], setUserRoles: [Function: setUserRoles], removeUsersFromRoles: [Function: removeUsersFromRoles], userIsInRole: [Function: userIsInRole], getRolesForUser: [Function: getRolesForUser], getAllRoles: [Function: getAllRoles], getUsersInRole: [Function: getUsersInRole], getGroupsForUser: [Function: getGroupsForUser], 'update$set_fn': [Function: update$set_fn], 'update$addToSet_fn': [Function: update$addToSet_fn], _updateUserRoles: [Function: _updateUserRoles] }

Thanks

SimonSimCity commented 4 years ago

It looks like you're still running on v1 when trying to run the migration script. Please first update your application to v2 and run the code again.

If it still doesn't work, please run the following code either in your application code or from the meteor console:

import("meteor/alanning:roles").then(p => {
  console.log("Start migration ...")
  p.Roles._forwardMigrate();
  console.log("Migration completed.")
})

This code is just an alternative way of calling the same functionality. It should work either way.

Please let me know if it still fails.

Ajaay commented 4 years ago

Sorry that's pretty obvious isn't it! Done and on v3 now. Thanks