For line 7 isn't it caught by this remaining conditional statement?
```
 if (!XT.username) {
    XT.username = plv8.execute('select current_user as username')[0].username;
  }
``` 
https://github.com/stanzheng/xtuple/blob/5518442218eaeae94bd977eafdeede06d9152620/enyo-client/database/source/public/functions/geteffectivextuser.sql#L7-9