Comments (13)
If I comment out the above code, I see the following in the console:
'WARNING: Roles Handlebars helpers not registered. Handlebars not defined'
from meteor-roles.
Hi @corinnas,
Thanks for the report and I'm sorry that the meteor-roles package isn't playing nicely for you!
To help determine where to start debugging can you try the following, please?
In a terminal/command prompt on linux/osx:
- mkdir ~/tmp
- cd ~/tmp
- meteor create test
- cd test
- mrt add roles
- meteor remove autopublish
- edit test.js to match contents below
- mrt
- Open http://localhost:3000/ in chrome or firefox and look at the developer console.
Contents of test.js:
if (Meteor.isClient) {
Meteor.startup(function () {
console.log(Roles)
})
Template.hello.greeting = function () {
return "Welcome to test.";
};
}
if (Meteor.isServer) {
Meteor.startup(function () {
console.log(Roles)
});
}
If the console displays something like, {createRole: function, deleteRole: function...} then we know its working correctly in a fresh project and we can focus on other possibilities.
Please let me know the outcome of the steps above.
from meteor-roles.
Hi @alanning,
I followed the steps you described. The server console output was this:
{ createRole: [Function],
deleteRole: [Function],
addUsersToRoles: [Function],
removeUsersFromRoles: [Function],
userIsInRole: [Function],
getRolesForUser: [Function],
getAllRoles: [Function],
getUsersInRole: [Function] }
The client console output was this:
Object
_handlebarsHelpers: Object
addUsersToRoles: function (users, roles) { // 99
createRole: function (role) { // 38
deleteRole: function (role) { // 71
getAllRoles: function () { // 251
getRolesForUser: function (user) { // 236
getUsersInRole: function (role) { // 262
removeUsersFromRoles: function (users, roles) { // 161
userIsInRole: function (user, roles) { // 197
__proto__: Object
test.js?1215fae36e61b04c509e24c019568abdca04202d:3
Error logging in with token: Error: Couldn't find login token [403]
from meteor-roles.
OK, that's good.
A few thoughts on what's happening... The first error seems to indicate that the Roles object is not being defined. This usually means the roles package hasn't been successfully added. I noticed that you ran, "meteor add roles". This doesn't work for me on my dev machine, i get a message stating, "roles: no such package". This is because meteor-roles is a Meteorite smart package which is not downloaded automatically when meteor is installed so you need to install Meteorite and then run, "mrt add roles" instead. That way Meteorite will connect to atmosphere.meteor.com and download the package for you.
The second error is what happens when Handlebars hasn't been included in your app. Which is strange because I thought Handlebars was automatically added by default. Did you perhaps remove the handlebars package?
Also, is the code you posted complete? It looks like it wouldn't work because there is no user._id field in the objects in your users array.
Would it be possible for you to post your code into a new, public github repo? If not, could you post a redacted version that still exhibits the problem?
from meteor-roles.
Been a while and haven't heard anything more so I'm going to close this issue.
If you are still having trouble getting it to work, please feel free to re-open and we can continue debugging.
from meteor-roles.
Hi @Karol86,
Thanks for following up on this! I'm reopening this issue as something definitely looks amiss. Seems I didn't support 0.6.5 as well as I thought I did!
I'll do some testing and report back.
from meteor-roles.
Hi!
I've just realized that corinnas issue has nothing in common with my issue. I don't why I thought it's the same.
I created issue 15.
Sorry about that confusion.
from meteor-roles.
I thought it was the same issue as well!
OK, closing again. :-)
from meteor-roles.
I just encountered this issue (after using "mrt install roles"). I think you accidentally uploaded an old version to atmosphere (or atmosphere is pulling the wrong commit? I am not sure how atmosphere works haha).
If I open packages/roles/package.js, the file contents are as follows:
Package.describe({
summary: "Role-based authorization"
});
Package.on_use(function (api) {
var both = ['client', 'server'];
api.use(['underscore', 'accounts-base'], both);
api.add_files('roles_server.js', 'server');
api.add_files('roles_common.js', both);
api.add_files('roles_client.js', 'client');
});
Package.on_test(function (api) {
// include accounts-password so Meteor.users exists
api.use(['roles','accounts-password','tinytest'], 'server');
api.add_files('tests/server.js', 'server');
api.add_files('tests/client.js', 'client');
});
I compared this to package.js in your repo. Note the absence of the line:
api.export && api.export('Roles');
I have put the roles subfolder of your git repo using a git clone in my packages folder and the error is now gone.
from meteor-roles.
Hi Joris,
Thank you! I'm not too sure how atmosphere works either but I'll double-check what I can see on their side. I thought that I had tested successfully with a clean install of the examples but it could certainly be that I forgot to push something.
Sent from my phone
On Oct 25, 2013, at 11:54 AM, Joris [email protected] wrote:
I just encountered this issue (after using "mrt install roles"). I think you accidentally uploaded an old version to atmosphere (or atmosphere is pulling the wrong commit? I am not sure how atmosphere works haha).
If I open packages/roles/package.js, the file contents are as follows:
Package.describe({
summary: "Role-based authorization"
});Package.on_use(function (api) {
var both = ['client', 'server'];
api.use(['underscore', 'accounts-base'], both);api.add_files('roles_server.js', 'server');
api.add_files('roles_common.js', both);
api.add_files('roles_client.js', 'client');
});Package.on_test(function (api) {
// include accounts-password so Meteor.users exists
api.use(['roles','accounts-password','tinytest'], 'server');api.add_files('tests/server.js', 'server');
api.add_files('tests/client.js', 'client');
});
I compared this to package.js in your repo. Note the absence of the line:api.export && api.export('Roles');
I have put the roles subfolder of your git repo using a git clone in my packages folder and the error is now gone.—
Reply to this email directly or view it on GitHub.
from meteor-roles.
I tried doing some clean installs on a fresh Ubuntu 12.04 vm and it seems to be working correctly for me.
Did you perhaps specify a version or commit hash in your smart.json? Maybe you had an older version of roles installed and then didn't do a mrt update
?
If you remove the roles package ( both directory and from smart.json ) and then add it back to smart.json and then run mrt install
do you see this?
tag: https://github.com/alanning/meteor-roles.git#v1.0.6
from meteor-roles.
I figured out what happened.
I installed another package first, which references 1.0.5. This caused my smart.lock to contain a reference to 1.0.5 too. No combination of mrt remove and mrt add would resolve this. I had to manually remove the entry from smart.lock.
The order in which I install packages affects this:
mrt create test && cd test
mrt add account-admin-ui
mrt add roles
my packages folder now contains version 1.0.5
mrt create test && cd test
mrt add roles
mrt add accounts-admin-ui
my packages folder now contains version 1.0.6
I created a pull request for accounts-admin-ui: kenyee/meteor-accounts-admin-ui#4
from meteor-roles.
Nice job tracking this down. I think the remove behavior of mrt is probably a bug as well. Probably not worth doing anything about now though as my impression is a lot of things will change once Meteor 1.0 ships.
Thanks for opening that ticket on Ken's project.
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.