signalk-server
Version: 
An implementation of a [Signal K](http://signalk.org) server for boats.
96 lines (94 loc) • 3.11 kB
JavaScript
;
/* eslint-disable @typescript-eslint/no-explicit-any */
/*
 * Copyright 2017 Scott Bender <scott@scottbender.net>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
function default_1() {
    const dummyStrategy = {
        getConfiguration: () => {
            return {};
        },
        allowRestart: (_req) => {
            return false;
        },
        allowConfigure: (_req) => {
            return false;
        },
        getLoginStatus: (_req) => {
            return {
                status: 'notLoggedIn',
                readOnlyAccess: false,
                authenticationRequired: false
            };
        },
        getConfig: (_config) => {
            return _config;
        },
        setConfig: (_config, _newConfig) => { },
        getUsers: (_config) => {
            return [];
        },
        updateUser: (_config, _username, _updates, _callback) => { },
        addUser: (_config, _user, _callback) => { },
        setPassword: (_config, _username, _password, _callback) => { },
        deleteUser: (_config, _username, _callback) => { },
        shouldAllowWrite: function (_req, _delta) {
            return true;
        },
        shouldAllowPut: function (_req, _context, _source, _path) {
            return true;
        },
        filterReadDelta: (_user, delta) => {
            return delta;
        },
        verifyWS: (_spark) => { },
        authorizeWS: (_req) => { },
        anyACLs: () => {
            return false;
        },
        checkACL: (_id, _context, _path, _source, _operation) => {
            return true;
        },
        isDummy: () => {
            return true;
        },
        canAuthorizeWS: () => {
            return false;
        },
        shouldFilterDeltas: () => {
            return false;
        },
        addAdminMiddleware: () => { },
        addAdminWriteMiddleware: () => { },
        addWriteMiddleware: () => { },
        allowReadOnly: () => {
            return true;
        },
        supportsLogin: () => false,
        getAuthRequiredString: () => {
            return 'never';
        },
        validateConfiguration: (_configuration) => { },
        configFromArguments: false,
        securityConfig: undefined,
        requestAccess: () => undefined
    };
    //force cast via unknown so that we don't need to
    //implement all dummy methods that are never called
    //with dummy strategy in place. or if they are called
    //the result will be an error.
    return dummyStrategy;
}