<commit_before>'use strict';

var module = angular.module('sislegisapp',
    ['ngRoute',
        'ngResource',
        'ngLocale',
        'ui.bootstrap',
        'ngTagsInput',
        'angularFileUpload',
        'ui.utils',
        'angular-confirm',
        'toaster',
        'angular.filter',
        'checklist-model',
        'angularjs-dropdown-multiselect',
        'infinite-scroll',
        'ui.mask'
    ]);

module.constant('BACKEND', 'http://BACKEND_SERVER/sislegis/rest');

var auth = {
    me: null,
    loggedIn: false,
    isAdmin: function () {
        return this.hasRole('ADMIN') || (auth.authz != null && auth.authz.hasRealmRole("admin"));//part dois é para o admin via keycloak
    },
    isSecretario: function (ascendente) {
        return this.hasRole('SECRETARIO') || (ascendente && this.isAdmin(true));
    },
    isDiretor: function (ascendente) {
        return this.hasRole('DIRETOR') || (ascendente && this.isSecretario(true));
    },
    isEquipe: function (ascendente) {

        return this.hasRole('EQUIPE') || (ascendente && this.isDiretor(true));
    },
    isAspar: function (ascendente) {
        return this.hasRole('ASPAR') || (ascendente && this.isEquipe(true));

    },
    hasRole: function (role) {
        if (this.me != null && this.me.papeis != null) {
            for (var index = 0; index < this.me.papeis.length; index++) {
                var element = this.me.papeis[index];
                if (element == role) {
                    return true;
                }
            }
        }
        return false;
    },
    refreshToken: function () {
        if (auth.authz != null) {
            auth.authz.updateToken(60).success(function (refreshed) {
                if (refreshed) {
                    console.log('Token was successfully refreshed');
                } else {
                    console.log('Token is still valid');
                }
            }).error(function () {
                console.log('Failed to refresh the token, or the session has expired');
            });
        } else {
            console.log("no authz")
        }
    },
    repeatId:null,
    initTokenRefresh:function(){
        var self = this;
        this.repeatId = setInterval(self.refreshToken, 30000);

    },
    logout:function(){
        clearInterval(this.repeatId);
        this.loggedIn = false;
        this.authz = null;
        window.location = this.logoutUrl;
    }
};

var logout = function () {
    auth.logout();
    <commit_msg>app com timeout maior<commit_after>'use strict';

var module = angular.module('sislegisapp',
    ['ngRoute',
        'ngResource',
        'ngLocale',
        'ui.bootstrap',
        'ngTagsInput',
        'angularFileUpload',
        'ui.utils',
        'angular-confirm',
        'toaster',
        'angular.filter',
        'checklist-model',
        'angularjs-dropdown-multiselect',
        'infinite-scroll',
        'ui.mask'
    ]);

module.constant('BACKEND', 'http://BACKEND_SERVER/sislegis/rest');

var auth = {
    me: null,
    loggedIn: false,
    isAdmin: function () {
        return this.hasRole('ADMIN') || (auth.authz != null && auth.authz.hasRealmRole("admin"));//part dois é para o admin via keycloak
    },
    isSecretario: function (ascendente) {
        return this.hasRole('SECRETARIO') || (ascendente && this.isAdmin(true));
    },
    isDiretor: function (ascendente) {
        return this.hasRole('DIRETOR') || (ascendente && this.isSecretario(true));
    },
    isEquipe: function (ascendente) {

        return this.hasRole('EQUIPE') || (ascendente && this.isDiretor(true));
    },
    isAspar: function (ascendente) {
        return this.hasRole('ASPAR') || (ascendente && this.isEquipe(true));

    },
    hasRole: function (role) {
        if (this.me != null && this.me.papeis != null) {
            for (var index = 0; index < this.me.papeis.length; index++) {
                var element = this.me.papeis[index];
                if (element == role) {
                    return true;
                }
            }
        }
        return false;
    },
    refreshToken: function () {
        if (auth.authz != null) {
            auth.authz.updateToken(180).success(function (refreshed) {
                if (refreshed) {
                    console.log('Token was successfully refreshed');
                } else {
                    console.log('Token is still valid');
                }
            }).error(function () {
                clearInterval(auth.repeatId);
                console.log('Failed to refresh the token, or the session has expired');
            });
        } else {
            console.log("no authz")
        }
    },
    repeatId:null,
    initTokenRefresh:function(){
        var self = this;
        this.repeatId = setInterval(self.refreshToken, 120000);

    },
    logout:function(){
        clearInterval(this.repeatId);
        this.loggedIn = false;
        this.authz = null;
        window.location = this.logoutUrl;
    }
};

var logout = function () {
    auth.logout();
    
{'fraction_non_alphanumeric': 0.14116251482799524, 'fraction_numerical': 0.0035587188612099642, 'mean_word_length': 1.907471264367816, 'pattern_counts': {'":': 0, '<': 5, '<?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': '714915', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1500, 'n_words': 296}