/**
 * Created by sghaida on 5/12/2017.
 */

exports.isLoggedIn = function(req, res, next) {
    if(req.isAuthenticated()){
        return next();
    } else {
        req.flash('error','Please login first')
        res.redirect('/login');
    }
};
@@ -241,8 +241,492 @@
     %7D%0A%7D;
+%0A%0Aexports.isSystemAdmin = function (req, res, next) %7B%0A    if (req.currentUser.roles.indexOf('system-admin') %3E -1)%7B%0A        return next();%0A    %7D else %7B%0A        req.flash('error', 'you dont have permission');%0A        req.redirect('back');%0A    %7D%0A%7D%0A%0Aexports.isSiteAdmin = function (req, res, next) %7B%0A    if (req.currentUser.roles.indexOf('site-admin') %3E -1)%7B%0A        return next();%0A    %7D else %7B%0A        req.flash('error', 'you dont have permission');%0A        req.redirect('back');%0A    %7D%0A%7D

add roles validators