Code Monkey home page Code Monkey logo

Comments (13)

corinnas avatar corinnas commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

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:

  1. mkdir ~/tmp
  2. cd ~/tmp
  3. meteor create test
  4. cd test
  5. mrt add roles
  6. meteor remove autopublish
  7. edit test.js to match contents below
  8. mrt
  9. 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.

corinnas avatar corinnas commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

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.

karollewandowski avatar karollewandowski commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

I thought it was the same issue as well!

OK, closing again. :-)

from meteor-roles.

Joris-van-der-Wel avatar Joris-van-der-Wel commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

@Joris-van-der-Wel ,

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.

Joris-van-der-Wel avatar Joris-van-der-Wel commented on May 22, 2024

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.

alanning avatar alanning commented on May 22, 2024

Hi @Joris-van-der-Wel,

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)

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.