<commit_before>/*jslint browser: true */
/*global define */
define([
    '../module',
    'lodash'
], function (app, lodash) {
    'use strict';

    app.service('MeService', ['Api', 'store', '$q', '$injector', '$timeout', 'config', function (Api, store, $q, $injector, $timeout, config) {
        // initialisation des permissions spéciales
        var special_permissions;
        $timeout(function () {
            special_permissions = $injector.get(config.permissionService).getSpecialPermissions();
        });


        /**
         * Authenticate against the API
         *
         * @param {Object} user
         * @returns {Promise}
         */
        this.login = function (user) {
            return Api.post('/session', user, {model: config.usermodel, silently: true});
        };

        /**
         * Disconnect (kill your session)
         *
         * @returns {Promise}
         */
        this.logout = function () {
            return Api.delete('/session');
        };

        /**<commit_msg>- small fix to prevent error if no permission service is defined in parent app<commit_after>/*jslint browser: true */
/*global define */
define([
    '../module',
    'lodash'
], function (app, lodash) {
    'use strict';

    app.service('MeService', ['Api', 'store', '$q', '$injector', '$timeout', 'config', function (Api, store, $q, $injector, $timeout, config) {
        // initialisation des permissions spéciales
        var special_permissions;
        if (config.permissionService) {
            $timeout(function () {
                special_permissions = $injector.get(config.permissionService).getSpecialPermissions();
            });
        }


        /**
         * Authenticate against the API
         *
         * @param {Object} user
         * @returns {Promise}
         */
        this.login = function (user) {
            return Api.post('/session', user, {model: config.usermodel, silently: true});
        };

        /**
         * Disconnect (kill your session)
         *
         * @returns {Promise}
         */
        this.logout = function () {
            return Api.delete('/session');
        };

        /**
{'fraction_non_alphanumeric': 0.14794267221451687, 'fraction_numerical': 0.0, 'mean_word_length': 1.9362279511533242, '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': '1946832', 'n_tokens_mistral': 591, 'n_tokens_neox': 584, 'n_words': 146}