nicolaslopezj / roles

The most advanced roles package for meteor
MIT License
87 stars 13 forks source link

Role 'admin' already defined #22

Closed aldofunes closed 8 years ago

aldofunes commented 8 years ago

Hello,

I am having problems defining roles. I get the following error:

Error: "admin" role is already defined
at new Roles.Role (packages/nicolaslopezj:roles/roles.js:90:11)
at meteorInstall.lib.roles.js (lib/roles.js:3:19)

Here is my /lib/roles.js file

import {Roles} from 'meteor/nicolaslopezj:roles';

const AdminRole = new Roles.Role('admin');
const EditorRole = new Roles.Role('editor');
const AuthorRole = new Roles.Role('author');
const SubscriberRole = new Roles.Role('subscriber');

export {AdminRole, EditorRole, AuthorRole, SubscriberRole};

There is no other file in which I define a role. Not even users added to admin role.

If I change the name to admin2 or something else, no errors are thrown.

Is there already a definition for admin role?

nicolaslopezj commented 8 years ago

Hi!

The admin role is a special role, which is defined by default.

https://github.com/nicolaslopezj/roles/blob/master/roles.js#L318

import {Roles} from 'meteor/nicolaslopezj:roles'

const AdminRole = Roles.adminRole
aldofunes commented 8 years ago

Oh, nice.

Thank you