<commit_before>(function() {
    'use strict';

    angular
        .module('assessoriaTorrellesApp')
        .controller('NavbarController', NavbarController);


    //Se ha importado $scope, y principal - Arnau
    NavbarController.$inject = ['$scope', '$state', 'Auth', 'Principal', 'ProfileService', 'LoginService', '$translate'];

    function NavbarController ($scope, $state, Auth, Principal, ProfileService, LoginService, $translate) {
        var vm = this;
        var authorities = "";

        //Account things - Arnau
        vm.account = null;

        vm.isAuthenticated = null;
        vm.login = LoginService.open;

        vm.isNavbarCollapsed = true;
        vm.isAuthenticated = Principal.isAuthenticated;

        ProfileService.getProfileInfo().then(function(response) {
            vm.inProduction = response.inProduction;
            vm.swaggerEnabled = response.swaggerEnabled;
        });

        vm.login = login;
        vm.logout = logout;
        vm.toggleNavbar = toggleNavbar;
        vm.collapseNavbar = collapseNavbar;
        vm.$state = $state;

        //Account things - Arnau
        $scope.$on('authenticationSuccess', function() {
            getAccount();
        });

        getAccount();

        function getAccount() {
            Principal.identity().then(function(account) {
                vm.account = account;
                vm.isAuthenticated = Principal.isAuthenticated;
                if(account.authorities[1] == "ROLE_ADMIN") {
                    vm.nameAuthorities = "global.menu.account.roleAdmin";
                }else {
                    vm.nameAuthorities = "global.menu.account.roleUser";
                }
            });<commit_msg>Fixed bug of undefined authorities<commit_after>(function() {
    'use strict';

    angular
        .module('assessoriaTorrellesApp')
        .controller('NavbarController', NavbarController);


    //Se ha importado $scope, y principal - Arnau
    NavbarController.$inject = ['$scope', '$state', 'Auth', 'Principal', 'ProfileService', 'LoginService', '$translate'];

    function NavbarController ($scope, $state, Auth, Principal, ProfileService, LoginService, $translate) {
        var vm = this;

        //Account things - Arnau
        vm.account = null;

        vm.login = LoginService.open;

        vm.isNavbarCollapsed = true;
        vm.isAuthenticated = Principal.isAuthenticated;

        ProfileService.getProfileInfo().then(function(response) {
            vm.inProduction = response.inProduction;
            vm.swaggerEnabled = response.swaggerEnabled;
        });

        vm.login = login;
        vm.logout = logout;
        vm.toggleNavbar = toggleNavbar;
        vm.collapseNavbar = collapseNavbar;
        vm.$state = $state;

        //Account things - Arnau
        $scope.$on('authenticationSuccess', function() {
            getAccount();
        });

        getAccount();

        function getAccount() {
            Principal.identity().then(function(account) {
                vm.account = account;
            });
{'fraction_non_alphanumeric': 0.11934426229508197, 'fraction_numerical': 0.0003278688524590164, 'mean_word_length': 2.1914225941422596, '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': '1368051', 'n_tokens_mistral': 833, 'n_tokens_neox': 787, 'n_words': 161}