<commit_before>"use strict";
var uracDriver = require('soajs.urac.driver');

function urac(param) {
    var _self = this;

    _self.soajs = param.soajs;

    _self.userRecord = null;
    _self.id = null;
    if (param.oauth && param.oauth.bearerToken && param.oauth.bearerToken.userId){
        _self.id = param.oauth.bearerToken.userId;
        console.log("ANTO")
        console.log(param.oauth.bearerToken.userId)
        if (param.oauth.bearerToken.userId.loginMode === "oauth")
            _self.userRecord = param.oauth.bearerToken.userId;
    }
}

/**
 * Initialize Driver and set userRecord if found
 * @param cb
 */
urac.prototype.init = function (cb) {
    var _self = this;
    if (_self.userRecord)
        cb(null, _self.userRecord);
    if (_self.id) {
        uracDriver.getRecord(_self.soajs, {id: _self.id.id.toString()}, function (err, record) {
	        if(record){
        	    _self.userRecord = record;
	        }
            cb(err, record);
        });
    }
    else {<commit_msg>minor bug fix<commit_after>"use strict";
var uracDriver = require('soajs.urac.driver');

function urac(param) {
    var _self = this;

    _self.soajs = param.soajs;

    _self.userRecord = null;
    _self.id = null;
    if (param.oauth && param.oauth.bearerToken && param.oauth.bearerToken.userId){
        _self.id = param.oauth.bearerToken.userId;
        if (param.oauth.bearerToken.userId.loginMode === "oauth")
            _self.userRecord = param.oauth.bearerToken.userId;
    }
}

/**
 * Initialize Driver and set userRecord if found
 * @param cb
 */
urac.prototype.init = function (cb) {
    var _self = this;
    if (_self.userRecord)
        return cb(null, _self.userRecord);
    
    if (_self.id) {
        uracDriver.getRecord(_self.soajs, {id: _self.id.id.toString()}, function (err, record) {
	        if(record){
        	    _self.userRecord = record;
	        }
            cb(err, record);
        });
    }
    else {
{'fraction_non_alphanumeric': 0.13720452209660844, 'fraction_numerical': 0.0, 'mean_word_length': 2.4157894736842107, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2084794', 'n_tokens_mistral': 675, 'n_tokens_neox': 674, 'n_words': 125}