Comments (7)
Additional: This is the event handler that is calling addUsersToRoles (or removeUsersFromRoles, same problem):
Template.admin_users.events = {
'click .admin': function() {
if(!this._id) return false;
if(_.contains(this.roles, "admin")) Roles.removeUsersFromRoles([this._id], ['admin']);
else Roles.addUsersToRoles([this._id], ['admin']);
},
};
And the value for 'this':
Object {
_id: "Bu75H9pQDafjx5EEc"
createdAt: 1365364990650
emails: Array[1]
roles: Array[0]
services: Object
__proto__: Object
}
from meteor-roles.
Hi Matt,
Thank you for reporting this!
I think this is due to the security update in Meteor v0.5.8. From the v0.5.8 release notes, "You must specify a single document ID when invoking [update & remove] from the client..."
Need to write tests for these failing cases and then add checks on the client to loop if more than one record needs to be updated/removed.
Good job tracking this down. Would you like to have a go at the fix? :-)
from meteor-roles.
Hi Adrian,
I've made a pull request with some code that should fix the issue, and also updated the documentation. Sorry, I'm really inexperienced with tests (especially in JS) so I don't think I can work on that just now (I also wasn't able to get the test suite to run anyway)...
Hope this helps!
from meteor-roles.
Hi Matt,
Great work! Thanks!
Re: tests
Yeah, I just tried running the existing tests and am having big problems with Meteorite and Meteor 0.6.0. I'll have to dig further into that.
One suggestion on the pull request. Instead of always performing the _.each, can you please add a check for Meteor.isClient and only do the loop on the client-side? Server-side would remain as before with the $in operator. That way the server doesn't take the performance hit of having to make multiple calls to the database. This is important in "user import" use-cases where an app could accept a large number of users and update their roles all in 1 db call.
from meteor-roles.
Sure, that makes sense. I've added some commits to my PR.
Yeah, the new 'var scoping' feature in Meteor 0.6.0 might be messing things up for you. Another heads up, if you haven't done it already, is to update Meteorite through npm (npm install -g meteorite
i think) -- Otherwise meteorite will hang when trying to run commands through it.
from meteor-roles.
Closed!
I'll push to atmosphere and also see what I can do to get tests working again.
Thanks for the help!
from meteor-roles.
fyi, published v1.0.5 to atmosphere with your fix, got tests working (see readme), and added you to the contributors section
from meteor-roles.
Related Issues (20)
- 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
- api docs still show v.3.4.0 in upper right corner HOT 1
- Not async? HOT 3
- Dependency on old [email protected] (need v3.0.0-rc300.1) HOT 3
- Roles.createRole is not a function (alanning:[email protected]) HOT 4
- Alpha 3 not compatible with Meteor 3 rc2 HOT 3
- Example app with selectable permissions HOT 4
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.