How to configure meteor-roles for xolvio:md-blog

62 views Asked by At

Hi everyone I'm trying to use the xolvio:md-blog package https://github.com/xolvio/md-blog to use this you have to set up roles using the alanning:roles package. My problem is that even though I did using a tutorial I found as a guide https://www.youtube.com/watch?v=nkDBnoiLQC0 to achieve this, for some reason it isn't working. Can anyone look at my code and see where I went wrong. P.S for the accounts I'm using ian:accounts-ui-bootstrap-3 Thanks in advance

Meteor.startup(function(){
if(Meteor.users.find().count <1){
    var users = [
        {name:'admin', email:'[email protected]', roles:['mdblog-author']}
    ];
    _.each(users,function(userData){
        var userid = Accounts.createUser({
            email:userData.email,
            password:'thecan15',
            username:userData.email,
            profile:{name:userData.name}
        })
        Meteor.users.update({_id:userid},{$set:{'emails.0.verified':true}})
        Roles.addUsersToRoles(userid,userData.roles);
    })
}
});

<template name="pills">
<div class="navmenu">
    <nav class="nav nav-pills navbar-fixed-top center-pills" role="navigation" data-toggle="affix">
        <li><a class="navbar-brand" href="#" data-toggle="collapse">TheLanguage</a></li>
        <li><a href="#" data-toggle="collapse" id="menu-toggle"><i class="glyphicon glyphicon-align-left"></i></a></li>
        <li><a href="{{pathFor'home'}}"><i class="glyphicon glyphicon-home"></i></a></li>
        <li><a href="{{pathFor'se'}}">So</a></li>
        <li><a href="{{pathFor'ga'}}">Gmg|T</a></li>
        <li><a href="{{pathFor'en'}}">Ete</a></li>
        <li><a href="{{pathFor'mu'}}">Mu</a></li>
        <li><a href="{{pathFor'fo'}}">Foo/a></li>
        <li><a href="{{pathFor'bl'}}">Wo</a></li>
        <li><a href="#"><i class="glyphicon glyphicon-search"></i></a></li>
        <li><a href="#">{{> loginButtons}}
            {{#if isInRole 'mdblog-author'}}
            {{/if}}
            </a></li>
    </nav>
</div>
<div class="container">

</div>

0

There are 0 answers