<commit_before>/**
 * GPII get token Handler
 *
 * Copyright 2014 Raising the Floor - International
 *
 * Licensed under the New BSD license. You may not use this file except in
 * compliance with this License.
 *
 * You may obtain a copy of the License at
 * https://github.com/gpii/universal/LICENSE.txt
 */

 /*global require*/

(function () {

    "use strict";

    var fluid = require("infusion"),
        request = fluid.registerNamespace("gpii.request.flowManager");

    fluid.defaults("kettle.requests.request.handler.getToken", {
        gradeNames: ["fluid.littleComponent", "autoInit"],
        invokers: {
            handle: {
                funcName: "gpii.request.flowManager.onGetToken",
                args: [
                    "{requestProxy}.events.onError"
                ],
                dynamic: true
            }
        }
    });

    request.onGetToken = function (event) {
        var msg = "Attempt to get token failed as session support is disabled";
        fluid.log(msg);
        event.fire({
            isError: true,
            message: msg
        });
    };

    fluid.defaults("kettle.gradeLinkageRecord.getTokenHandlerSession", {
        gradeNames: ["autoInit", "fluid.gradeLinkageRecord"],
        contextGrades: ["gpii.flowManager.handlerSession",
            "kettle.requests.request.handler.getToken"],
        resultGrades: ["gpii.flowManager.getTokenSession"]
    });

    fluid.defaults("gpii.flowManager.getTokenSession", {
        gradeNames: ["fluid.littleComponent", "autoInit"],
        invokers: {
            handle: {
                funcName: "gpii.request.flowManager.onGetTokenSession",
                args: [
                    "{request}.session.session.token",
                    "{requestProxy}.events"
                ],
                dynamic: true
            }
        }
    });

    request.onGetTokenSession = function (token, events) {
        if (token) {
            fluid.log("Reporting currently logged in user as: "+token);
            events.onSuccess.fire(token);
        } else {
            events.onError.fire({
                isError: true,
                message: "No user currently logged into the system"
            });
        }
    };
})();
<commit_msg>GPII-290: Removed dynamic flag and added comment as requested from <NAME><commit_after>/**
 * GPII get token Handler
 *
 * Copyright 2014 Raising the Floor - International
 *
 * Licensed under the New BSD license. You may not use this file except in
 * compliance with this License.
 *
 * You may obtain a copy of the License at
 * https://github.com/gpii/universal/LICENSE.txt
 */

 /*global require*/

(function () {

    "use strict";

    var fluid = require("infusion"),
        request = fluid.registerNamespace("gpii.request.flowManager");

    fluid.defaults("kettle.requests.request.handler.getToken", {
        gradeNames: ["fluid.littleComponent", "autoInit"],
        invokers: {
            handle: {
                funcName: "gpii.request.flowManager.onGetToken",
                args: [
                    "{requestProxy}.events.onError"
                ]
            }
        }
    });

    request.onGetToken = function (event) {
        var msg = "Attempt to get token failed as session support is disabled";
        fluid.log(msg);
        event.fire({
            isError: true,
            message: msg
        });
    };

    //This strategy is slightly instane and should be fixed as part of GPII-584
    fluid.defaults("kettle.gradeLinkageRecord.getTokenHandlerSession", {
        gradeNames: ["autoInit", "fluid.gradeLinkageRecord"],
        contextGrades: ["gpii.flowManager.handlerSession",
            "kettle.requests.request.handler.getToken"],
        resultGrades: ["gpii.flowManager.getTokenSession"]
    });

    fluid.defaults("gpii.flowManager.getTokenSession", {
        gradeNames: ["fluid.littleComponent", "autoInit"],
        invokers: {
            handle: {
                funcName: "gpii.request.flowManager.onGetTokenSession",
                args: [
                    "{request}.session.session.token",
                    "{requestProxy}.events"
                ],
                dynamic: true
            }
        }
    });

    request.onGetTokenSession = function (token, events) {
        if (token) {
            fluid.log("Reporting currently logged in user as: "+token);
            events.onSuccess.fire(token);
        } else {
            events.onError.fire({
                isError: true,
                message: "No user currently logged into the system"
            });
        }
    };
})();

{'fraction_non_alphanumeric': 0.11539294219528036, 'fraction_numerical': 0.0030309590820523924, 'mean_word_length': 1.8875, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '924842', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1204, 'n_words': 281}