<commit_before>'use strict';

angular.module('arachne.controllers')

/**
 * Handles the layout for editing the catalog structure.
 *
 * @author: <NAME>, <NAME>, <NAME>
 */
    .controller('CatalogsController',['$scope', '$uibModal', 'authService', 'Entity', 'Catalog', 'CatalogEntry', '$http', 'arachneSettings', 'message',
        function ($scope, $uibModal, authService, Entity, Catalog, CatalogEntry, $http, arachneSettings, message) {

            $scope.catalogs = [];
            $scope.entryMap = {};
            $scope.user = authService.getUser();
            $scope.childrenLimit = 10;

            $http.get(arachneSettings.dataserviceUri + '/userinfo/' + $scope.user.username).success(function(user) {
                $scope.user = user;
            });

            $scope.loading = 0;

            $scope.treeOptions = {
                beforeDrop: function(event) {
                    var movedEntry = $scope.entryMap[event.source.nodeScope.$modelValue.id];
                    var tempEntry = angular.copy(movedEntry);
                    var newParentId;
                    if (event.dest.nodesScope.$parent.$modelValue) {
                        newParentId = event.dest.nodesScope.$parent.$modelValue.id;
                    } else {
                        newParentId = $scope.activeCatalog.root.id;
                    }
                    tempEntry.parentId = newParentId;
                    tempEntry.indexParent = event.dest.index;
                    if (tempEntry.indexParent != movedEntry.indexParent || tempEntry.parentId != movedEntry.parentId) {
                        var promise = CatalogEntry.update({id: movedEntry.id}, tempEntry).$promise.then(function () {
                            if (movedEntry.parentId != newParentId) {
                                $scope.entryMap[movedEntry.parentId].totalChildren -= 1;
                                $scope.entryMap[newParentId].totalChildren += 1;
                            }
                            movedEntry.parentId = newParentId;<commit_msg>Check for missing user rights (fixes #3303).<commit_after>'use strict';

angular.module('arachne.controllers')

/**
 * Handles the layout for editing the catalog structure.
 *
 * @author: <NAME>, <NAME>, <NAME>
 */
    .controller('CatalogsController',['$scope', '$uibModal', 'authService', 'Entity', 'Catalog', 'CatalogEntry', '$http', 'arachneSettings', 'message',
        function ($scope, $uibModal, authService, Entity, Catalog, CatalogEntry, $http, arachneSettings, message) {

            $scope.user = authService.getUser();
            if ($scope.user === undefined) {
                return false;
            }

            $scope.catalogs = [];
            $scope.entryMap = {};

            $scope.childrenLimit = 10;

            $http.get(arachneSettings.dataserviceUri + '/userinfo/' + $scope.user.username).success(function(user) {
                $scope.user = user;
            });

            $scope.loading = 0;

            $scope.treeOptions = {
                beforeDrop: function(event) {
                    var movedEntry = $scope.entryMap[event.source.nodeScope.$modelValue.id];
                    var tempEntry = angular.copy(movedEntry);
                    var newParentId;
                    if (event.dest.nodesScope.$parent.$modelValue) {
                        newParentId = event.dest.nodesScope.$parent.$modelValue.id;
                    } else {
                        newParentId = $scope.activeCatalog.root.id;
                    }
                    tempEntry.parentId = newParentId;
                    tempEntry.indexParent = event.dest.index;
                    if (tempEntry.indexParent != movedEntry.indexParent || tempEntry.parentId != movedEntry.parentId) {
                        var promise = CatalogEntry.update({id: movedEntry.id}, tempEntry).$promise.then(function () {
                            if (movedEntry.parentId != newParentId) {
                                $scope.entryMap[movedEntry.parentId].totalChildren -= 1;
                                $scope.entryMap[newParentId].totalChildren += 1;
                            }
                            movedEntry.parentId = newParentId;
{'fraction_non_alphanumeric': 0.12209026128266033, 'fraction_numerical': 0.00332541567695962, 'mean_word_length': 1.7361923326835607, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '210284', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1059, 'n_words': 186}