Giter VIP home page Giter VIP logo

Comments (5)

alanning avatar alanning commented on July 30, 2024

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.

ggmacasaet avatar ggmacasaet commented on July 30, 2024

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.

alanning avatar alanning commented on July 30, 2024

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.

ggmacasaet avatar ggmacasaet commented on July 30, 2024

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.

alanning avatar alanning commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.