| Total Complexity | 6 | 
| Complexity/F | 6 | 
| Lines of Code | 26 | 
| Function Count | 1 | 
| Duplicated Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | import Cookies from 'cookies'  | 
            ||
| 2 | import jwt from 'jwt-simple'  | 
            ||
| 3 | |||
| 4 | import { | 
            ||
| 5 | config,  | 
            ||
| 6 | User  | 
            ||
| 7 | } from '../../../'  | 
            ||
| 8 | |||
| 9 | /**  | 
            ||
| 10 | * Handlebars helper, to print className and escape it string  | 
            ||
| 11 | */  | 
            ||
| 12 | export default function getCurrentuserRole(obj) { | 
            ||
| 13 |   if(typeof obj.express !== 'undefined' && obj.express !== null) { | 
            ||
| 14 |     var cookies = new Cookies(obj.express.req, obj.express.res, { | 
            ||
| 15 | secure: config.cookie.secure  | 
            ||
| 16 | })  | 
            ||
| 17 |     var token = cookies.get('x-access-token') | 
            ||
| 18 |     if(typeof token !== 'undefined' && token !== null && token !== '') { | 
            ||
| 19 | var secret = config.users.secret  | 
            ||
| 20 | var decoded = jwt.decode(token, secret)  | 
            ||
| 21 | var user = User.utils.findSync(decoded.iss)  | 
            ||
| 22 | return user.role.workflow  | 
            ||
| 23 | }  | 
            ||
| 24 | }  | 
            ||
| 25 | return ''  | 
            ||
| 26 | }  | 
            ||
| 27 |