Comments (5)
Hi @ggmacasaet,
Roles.removeUsersFromRoles
doesn't actually perform any inserts so I'd guess the error is being generated from a different method call.
Are you perhaps calling Roles.createRole("Tutor")
multiple times?
It is strange that you would be seeing that error at all though since the code explicitly catches E11000 errors and throws a Meteor.Error(403, "Role already exists.")
instead.
Can you post up a public example which reproduces the error onto github?
from meteor-roles.
Hi @alanning,
I am only using Roles.createRole("Tutor") in Meteor.startup so i don't believe it should create it again once i click a button to remove a user from a role.
To give a background, what i am using is Meteor-autoform package to call a Meteor Method to remove the user from a specific role then it shows that error.
from meteor-roles.
I would guess that the error message you are seeing in the console is actually being thrown during startup since that is when the createRole call is being made. If you comment out the Roles.createRole("Tutor")
call in Meteor.startup, does the error disappear?
If not, can you put together a public reproduction of this issue?
from meteor-roles.
I think i got the issue. You can't remove a user from a role or add a user to a role if your also updating the user details. I think this is a restriction from Meteor that you cannot update a same collection within a specific period of time. I think the Roles method is also updating the user collection.
Anyway, thanks for the comments and suggestions @alanning.
from meteor-roles.
Glad you worked it out.
Meteor shouldn't have any restrictions on timing of updates so if you can reliably reproduce the issue it should be logged as a bug. Roles.createRole("Tutor")
won't update the user collection but the add user and remove user functions do.
If you'd like more help, please publish an example to github and I'll take a look.
from meteor-roles.
Related Issues (20)
- v2 - Roles._forwardMigrate() just removes all users from roles HOT 2
- API docs linked to old version of codes HOT 1
- getUsersInRole reactivity? HOT 1
- getScopesForUser is not in documentation HOT 1
- How to run migration script from V1 -> V3 HOT 3
- Exception on subscription: $in needs an array.
- Support new Meteor async API (Meteor 2.8+) HOT 2
- Defaut publication uses only user._id, but no index is created on that field only HOT 2
- cannot add data into role-assignment HOT 3
- Meteor.roleAssignment, error: Property 'roleAssignment' does not exist on type 'typeof Meteor'. HOT 5
- Weird issue with role-assignement.. HOT 2
- Upgrading from 3.4.0 to 3.5.0 introduces 6x node "UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'isCalledFromAsync' of undefined" warnings. HOT 1
- TypeError: Cannot set property 'isCalledFromAsync' of undefined ... HOT 4
- Improve community standards HOT 1
- Add code quality tools HOT 2
- Add selector to Roles.getUsersInRole HOT 2
- forwardMigrate2 tries to drop unset index HOT 1
- Add new function to change scope of existing role assignment HOT 1
- addRolesToParent -> Reset inheritance as unwanted roles may still be connected HOT 1
- Get a list of users with a scope HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-roles.