All files / web/bundles/pimui/js/job/execution download-log.js

100% Statements 10/10
100% Branches 6/6
100% Functions 2/2
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                378x                 378x         1951x 1951x 769x 166x 603x 482x   121x     1182x            
'use strict';
/**
 * Download log button
 *
 * @author    Alban Alnot <alban.alnot@consertotech.pro>
 * @copyright 2017 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
define(
    [
        'pim/form/common/download-file',
        'pim/security-context'
    ],
    function (
        DownloadFile,
        SecurityContext
    ) {
        return DownloadFile.extend({
            /**
             * {@inheritdoc}
             */
            isVisible: function () {
                var formData = this.getFormData();
                if (DownloadFile.prototype.isVisible.apply(this)) {
                    if (formData.jobInstance.type === 'export') {
                        return SecurityContext.isGranted(this.config.aclIdExport);
                    } else if (formData.jobInstance.type === 'import') {
                        return SecurityContext.isGranted(this.config.aclIdImport);
                    } else {
                        return true;
                    }
                } else {
                    return false;
                }
            }
        });
    }
);