'use strict';

console.log('TESTTTT');

var mean = require('meanio');

exports.render = function (req, res) {

    function isAdmin() {
        return req.user && req.user.roles.indexOf('admin') !== -1;
    }

    // Send some basic starting info to the view
    res.render('index', {
        user: req.user ? {
            name: req.user.name,
            _id: req.user._id,
            username: req.user.username,
            roles: req.user.roles
        } : {},
        modules: 'ho',
        motti: 'motti is cool',
        isAdmin: 'motti',
        adminEnabled: isAdmin() && mean.moduleEnabled('mean-admin')
    });
};
