orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

Loosing roles in admin panel #382

Open chompomonim opened 8 years ago

chompomonim commented 8 years ago

After creating new role I can't see it in admin panel. What I'm doing wrong?

@roles = {}
Roles.registerAction('news.update', true)

setNewsRole = (role_name, country_id) ->
  unless @roles[role_name]
    @roles[role_name] = new Roles.Role role_name

  @roles[role_name].allow 'collections.news.index', true
  @roles[role_name].allow 'collections.news.insert', true
  @roles[role_name].allow 'news.update', (userId, doc, fields, modifier) ->
    return doc.userId is userId # Allowed to edit own news
  @roles[role_name].allow 'collections.news.showCreate', true
  @roles[role_name].allow 'collections.news.showUpdate', true

  if country_id
    @roles[role_name].helper 'collections.news.indexFilter', { 'country': country_id }

Meteor.startup ->
  for country in Countries.find().fetch()
    setNewsRole("#{country.short_name}-admin", country._id)
chompomonim commented 8 years ago

BTW it can be related with migration into 2.1.2 (from 1.5.3) because before everything worked fine.