<commit_before>define(['angular','feed-mgr/categories/module-name'], function (angular,moduleName) {
    /**
     * Manages the Category Details page for creating and editing categories.
     *
     * @param $scope the application model
     * @param $transition$ the URL parameters
     * @param CategoriesService the category service
     * @constructor
     */
    function CategoryDetailsController($scope, $transition$, CategoriesService, AccessControlService) {
        var self = this;

        /**
         * Indicates if the category is currently being loaded.
         * @type {boolean} {@code true} if the category is being loaded, or {@code false} if it has finished loading
         */
        self.loadingCategory = true;


        self.showAccessControl = AccessControlService.isEntityAccessControlled();

        /**
         * Category data.
         * @type {CategoryModel}
         */
        self.model = {};
        $scope.$watch(
            function () {
                return CategoriesService.model
            },
            function (model) {
                self.model = model
            },
            true
        );

        /**
         * Loads the category data once the list of categories has loaded.
         */
        self.onLoad = function () {
            if (angular.isString($transition$.params().categoryId)) {
                self.model = CategoriesService.model = CategoriesService.findCategory($transition$.params().categoryId);
                CategoriesService.getRelatedFeeds(CategoriesService.model);
                self.loadingCategory = false;
            } else {
                CategoriesService.getUserFields()
                    .then(function (userFields) {
                        CategoriesService.model = CategoriesService.newCategory();
                        CategoriesService.model.userProperties = userFields;
                        self.loadingCategory = false;
                    });
            }
        };

        // Load the list of categories
        if (CategoriesService.categories.length === 0) {
            CategoriesService.reload().then(self.onLoad);
        } else {
            self.onLoad();
        }
    }

    angular.module(moduleName).controller('CategoryDetailsController', ["$scope","$transition$","CategoriesService","AccessControlService",CategoryDetailsController]);
});<commit_msg>KYLO-626 only show category access control section to select users<commit_after>define(['angular','feed-mgr/categories/module-name'], function (angular,moduleName) {
    /**
     * Manages the Category Details page for creating and editing categories.
     *
     * @param $scope the application model
     * @param $transition$ the URL parameters
     * @param CategoriesService the category service
     * @constructor
     */
    function CategoryDetailsController($scope, $transition$, $q,CategoriesService, AccessControlService) {
        var self = this;

        /**
         * Indicates if the category is currently being loaded.
         * @type {boolean} {@code true} if the category is being loaded, or {@code false} if it has finished loading
         */
        self.loadingCategory = true;


        self.showAccessControl = false;

        /**
         * Category data.
         * @type {CategoryModel}
         */
        self.model = {};
        $scope.$watch(
            function () {
                return CategoriesService.model
            },
            function (model) {
                self.model = model
            },
            true
        );

        /**
         * Loads the category data once the list of categories has loaded.
         */
        self.onLoad = function () {
            if (angular.isString($transition$.params().categoryId)) {
                self.model = CategoriesService.model = CategoriesService.findCategory($transition$.params().categoryId);
                CategoriesService.getRelatedFeeds(CategoriesService.model);
                self.loadingCategory = false;
            } else {
                CategoriesService.getUserFields()
                    .then(function (userFields) {
                        CategoriesService.model = CategoriesService.newCategory();
                        CategoriesService.model.userProperties = userFields;
                        self.loadingCategory = false;
                    });
            }
        };

        // Load the list of categories
        if (CategoriesService.categories.length === 0) {
            CategoriesService.reload().then(self.onLoad);
        } else {
            self.onLoad();
        }


        if(AccessControlService.isEntityAccessControlled()) {
            //Apply the entity access permissions... only showAccessControl if the user can change permissions
            $q.when(AccessControlService.hasPermission(AccessControlService.CATEGORIES_ACCESS, self.model, AccessControlService.ENTITY_ACCESS.CATEGORY.CHANGE_CATEGORY_PERMISSIONS)).then(
                function (access) {
                    self.showAccessControl = access;
                });
        }
    }

    angular.module(moduleName).controller('CategoryDetailsController', ["$scope","$transition$","$q","CategoriesService","AccessControlService",CategoryDetailsController]);
});
{'fraction_non_alphanumeric': 0.10015203344735842, 'fraction_numerical': 0.0009502090459901178, 'mean_word_length': 1.978494623655914, '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': '5046907', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1180, 'n_words': 280}