core/server/api/v0.1/authentication.js
function assertSetupCompleted(status) {
    return function checkPermission(__) {
        return checkSetup().then((isSetup) => {
            if (isSetup === status) {
                return __;
            }

            const completed = common.i18n.t('errors.api.authentication.setupAlreadyCompleted'),
                notCompleted = common.i18n.t('errors.api.authentication.setupMustBeCompleted');

            function throwReason(reason) {
                throw new common.errors.NoPermissionError({message: reason});
            }

            if (isSetup) {
                throwReason(completed);
            } else {
                throwReason(notCompleted);
            }
        });
    };
}
function assertSetupCompleted(status) {
    return function checkPermission(__) {
        return checkSetup().then((isSetup) => {
            if (isSetup === status) {
                return __;
            }

            const completed = common.i18n.t('errors.api.authentication.setupAlreadyCompleted'),
                notCompleted = common.i18n.t('errors.api.authentication.setupMustBeCompleted');

            function throwReason(reason) {
                throw new common.errors.NoPermissionError({message: reason});
            }

            if (isSetup) {
                throwReason(completed);
            } else {
                throwReason(notCompleted);
            }
        });
    };
}
function assertSetupCompleted ( status ) { return function checkPermission ( __ ) { return checkSetup ( ) . then ( ( isSetup ) => { if ( isSetup === status ) { return __ ; } const completed = common . i18n . t ( 'errors.api.authentication.setupAlreadyCompleted' ) , notCompleted = common . i18n . t ( 'errors.api.authentication.setupMustBeCompleted' ) ; function throwReason ( reason ) { throw new common . errors . NoPermissionError ( { message : reason } ) ; } if ( isSetup ) { throwReason ( completed ) ; } else { throwReason ( notCompleted ) ; } } ) ; } ; }
Allows an assertion to be made about setup status.

@param  {Boolean} status True: setup must be complete. False: setup must not be complete.
@return {Function} returns a "task ready" function
Allows an assertion to be made about setup status .