scorpiusjs / scorpius

Modular admin solution built with Meteor
http://scorpiusjs.org
MIT License
34 stars 7 forks source link

New issue concerning Roles and Admin #17

Closed mmazloum closed 7 years ago

mmazloum commented 7 years ago

First I'm used to orion and Meteor, and I'm pleased to see this scorpius project.

I get this error when ever I try to create my first admin user : (STDERR) Error: Match error: Expected string, got object (STDERR) at exports.check (packages/check/match.js:34:1) (STDERR) at Object.Roles.addUserToRoles (packages/nicolaslopezj_roles/roles_server.js:18:1) (STDERR) at Object. (packages/scorpiusjs:accounts/accounts_server.js:13:11)

It seems that scorpius uses nicolaslopezj_roles in its core and anytime a user is created, even if I don't ask to add a role this error occurs ?

This results in not being able to see my collections in the side menu.

Any idea of what happens ?

rwatts3 commented 7 years ago

Have you tried setting s default role. Take a look at orion examples blog. I believe its under startup. I'm planning to fix this in scorpius core. But for now that also existed in the original project.

On Thu, Sep 15, 2016, 10:09 AM mmazloum notifications@github.com wrote:

First I'm used to orion and Meteor, and I'm pleased to see this scorpius project.

I get this error when ever I try to create my first admin user : (STDERR) Error: Match error: Expected string, got object (STDERR) at exports.check (packages/check/match.js:34:1) (STDERR) at Object.Roles.addUserToRoles (packages/nicolaslopezj_roles/roles_server.js:18:1) (STDERR) at Object. (packages/scorpiusjs:accounts/accounts_server.js:13:11)

It seems that scorpius uses nicolaslopezj_roles in its core and anytime a user is created, even if I don't ask to add a role this error occurs ?

This results in not being able to see my collections in the side menu.

Any idea of what happens ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/scorpiusjs/scorpius/issues/17, or mute the thread https://github.com/notifications/unsubscribe-auth/AFFsSUacAQMwrOlJYCE4Pk-aWTzo685Yks5qqXvBgaJpZM4J-G_Z .

mmazloum commented 7 years ago

here is a work arround (to replace the fixture suggested in the orion tutorial): ` if ( Meteor.users.find().count() === 0) { console.log("Adding Marwan"); marwanId = Accounts.createUser({ profile: { name: 'Marwan Mazloum' }, username: 'Marwan', email: 'XXXXXX', password: 'XXXXX' }); console.log("Marwan Id :" + marwanId); Roles.addUserToRoles(marwanId, ["admin"]); }

let marwan = Meteor.users.findOne({username: 'Marwan'});
if (marwan) {
  console.log(marwan);
  Roles.addUserToRoles(marwan._id, ["admin"]);

}`

then my default profile activates admin functions in orion CMS.

rwatts3 commented 7 years ago

This is nice.

I'll be sure to update docs after testing, across other roles etc. ...

rwatts3 commented 7 years ago

P.s. Scorpius docs are still to come they will be available in the near future.

avishaan commented 7 years ago

@rwatts3 this is a show stopper, I was about to switch to Yogiben admin panel because I couldn't find a solution

mmazloum commented 7 years ago

@codeHatcher if you add the role in a second if() the role is added.

avishaan commented 7 years ago

@mmazloum that's what I ended up doing

Kiel-H-Byrne commented 7 years ago

@codeHatcher ; can i see an example of what worked for you? this is making my server skip and only started when i tried to add multiple admins.

avishaan commented 7 years ago

@tdotholla I don't remember which project I was using when I had this issue. If you can give me something simple that reproduces your error I don't mind spend 15 minutes to try and fix it for you

or at the very least show me your fixture code and error message