{
    "definitions": {
        "allowed": {
            "additionalItems": true,
            "format": "table",
            "items": {
                "properties": {
                    "name": {
                        "$ref": "#/definitions/name",
                        "description": "An allowed key",
                        "title": "Path"
                    },
                    "read": {
                        "default": true,
                        "format": "checkbox",
                        "title": "Can Read",
                        "type": "boolean"
                    },
                    "write": {
                        "default": false,
                        "format": "checkbox",
                        "title": "Can Write",
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "minItems": 0,
            "name": "allowed",
            "type": "array",
            "_uniqueItems": true
        },
        "denied": {
            "additionalItems": true,
            "format": "table",
            "items": {
                "properties": {
                    "name": {
                        "$ref": "#/definitions/name",
                        "description": "A denied key",
                        "title": "Key"
                    },
                    "read": {
                        "default": true,
                        "format": "checkbox",
                        "title": "Block Read",
                        "type": "boolean"
                    },
                    "write": {
                        "default": true,
                        "format": "checkbox",
                        "title": "Block Write",
                        "type": "boolean"
                    }
                },
                "type": "object"
            },
            "minItems": 0,
            "name": "denied",
            "type": "array",
            "_uniqueItems": true
        },
        "name": {
            "enum": [
                "all",
                "none",
                "aircraft",
                "aton",
                "config",
                "sar",
                "sources",
                "resources",
                "resources.charts",
                "resources.notes",
                "resources.regions",
                "resources.routes",
                "resources.waypoints",
                "vessels",
                "vessels.self",
                "vessels.self.communication",
                "vessels.self.communication.callsignHf",
                "vessels.self.communication.callsignVhf",
                "vessels.self.communication.crewNames",
                "vessels.self.communication.email",
                "vessels.self.communication.emailHf",
                "vessels.self.communication.phoneNumber",
                "vessels.self.communication.satPhoneNumber",
                "vessels.self.communication.skipperName",
                "vessels.self.design",
                "vessels.self.design.airHeight",
                "vessels.self.design.aisShipType",
                "vessels.self.design.beam",
                "vessels.self.design.displacement",
                "vessels.self.design.draft",
                "vessels.self.design.length",
                "vessels.self.electrical",
                "vessels.self.electrical.ac",
                "vessels.self.electrical.alternators",
                "vessels.self.electrical.batteries",
                "vessels.self.electrical.chargers",
                "vessels.self.electrical.inverters",
                "vessels.self.electrical.solar",
                "vessels.self.environment",
                "vessels.self.environment.current",
                "vessels.self.environment.depth",
                "vessels.self.environment.heave",
                "vessels.self.environment.inside",
                "vessels.self.environment.mode",
                "vessels.self.environment.outside",
                "vessels.self.environment.tide",
                "vessels.self.environment.time",
                "vessels.self.environment.water",
                "vessels.self.environment.wind",
                "vessels.self.environment.wind.angleApparent",
                "vessels.self.environment.wind.angleTrueGround",
                "vessels.self.environment.wind.angleTrueWater",
                "vessels.self.environment.wind.directionChangeAlarm",
                "vessels.self.environment.wind.directionMagnetic",
                "vessels.self.environment.wind.directionTrue",
                "vessels.self.environment.wind.speedApparent",
                "vessels.self.environment.wind.speedOverGround",
                "vessels.self.environment.wind.speedTrue",
                "vessels.self.navigation",
                "vessels.self.navigation.anchor",
                "vessels.self.navigation.attitude",
                "vessels.self.navigation.closestApproach",
                "vessels.self.navigation.courseGreatCircle",
                "vessels.self.navigation.courseOverGroundMagnetic",
                "vessels.self.navigation.courseOverGroundTrue",
                "vessels.self.navigation.courseRhumbline",
                "vessels.self.navigation.datetime",
                "vessels.self.navigation.destination",
                "vessels.self.navigation.gnss",
                "vessels.self.navigation.headingMagnetic",
                "vessels.self.navigation.headingTrue",
                "vessels.self.navigation.leewayAngle",
                "vessels.self.navigation.lights",
                "vessels.self.navigation.log",
                "vessels.self.navigation.maneuver",
                "vessels.self.navigation.position",
                "vessels.self.navigation.racing",
                "vessels.self.navigation.rateOfTurn",
                "vessels.self.navigation.speedOverGround",
                "vessels.self.navigation.speedThroughWater",
                "vessels.self.navigation.speedThroughWaterLongitudinal",
                "vessels.self.navigation.speedThroughWaterTransverse",
                "vessels.self.navigation.state",
                "vessels.self.navigation.trip",
                "vessels.self.performance",
                "vessels.self.performance.beatAngle",
                "vessels.self.performance.beatAngleTargetSpeed",
                "vessels.self.performance.beatAngleVelocityMadeGood",
                "vessels.self.performance.gybeAngle",
                "vessels.self.performance.gybeAngleTargetSpeed",
                "vessels.self.performance.gybeAngleVelocityMadeGood",
                "vessels.self.performance.leeway",
                "vessels.self.performance.polarSpeed",
                "vessels.self.performance.polarSpeedRatio",
                "vessels.self.performance.tackMagnetic",
                "vessels.self.performance.tackTrue",
                "vessels.self.performance.targetAngle",
                "vessels.self.performance.targetSpeed",
                "vessels.self.performance.velocityMadeGood",
                "vessels.self.propulsion",
                "vessels.self.sails",
                "vessels.self.sails.area",
                "vessels.self.sails.inventory",
                "vessels.self.sensors",
                "vessels.self.steering",
                "vessels.self.steering.autopilot",
                "vessels.self.steering.autopilot.gain",
                "vessels.self.steering.autopilot.mode",
                "vessels.self.steering.autopilot.state",
                "vessels.self.steering.autopilot.target",
                "vessels.self.steering.rudderAngle",
                "vessels.self.tanks",
                "vessels.self.tanks.ballast",
                "vessels.self.tanks.blackWater",
                "vessels.self.tanks.freshWater",
                "vessels.self.tanks.fuel",
                "vessels.self.tanks.gas",
                "vessels.self.tanks.liveWell",
                "vessels.self.tanks.lubrication",
                "vessels.self.tanks.wasteWater"
            ],
            "type": "string"
        }
    },
    "properties": {
        "net": {
            "_id": "http://jsonschema.net/signalk/config/server/security",
            "additionalProperties": false,
            "description": "Control access by network or IP",
            "format": "categories",
            "name": "net",
            "properties": {
                "config": {
                    "_id": "http://jsonschema.net/signalk/config/server/security/config",
                    "additionalProperties": false,
                    "description": "Limit access to configuration",
                    "name": "config",
                    "properties": {
                        "ip": {
                            "_id": "http://jsonschema.net/signalk/config/server/security/config/ip",
                            "additionalItems": true,
                            "description": "Allow from IP (eg 192.168.0.1) or network (eg  or 192.186.0.0/24)",
                            "format": "table",
                            "items": {
                                "_id": "http://jsonschema.net/signalk/config/server/security/config/ip/0",
                                "default": "",
                                "description": "",
                                "minLength": 1,
                                "name": "0",
                                "title": "IP address",
                                "type": "string"
                            },
                            "minItems": 0,
                            "name": "ip",
                            "title": "IP Address",
                            "type": "array",
                            "_uniqueItems": true
                        }
                    },
                    "required": [
                        "ip"
                    ],
                    "title": "Config List",
                    "type": "object"
                },
                "deny": {
                    "_id": "http://jsonschema.net/signalk/config/server/security/deny",
                    "additionalProperties": false,
                    "description": "Deny these source addresses",
                    "name": "deny",
                    "properties": {
                        "ip": {
                            "_id": "http://jsonschema.net/signalk/config/server/security/deny/ip",
                            "additionalItems": true,
                            "description": "Deny from IP (eg 192.168.0.1) or network (eg  or 192.186.0.0/24)",
                            "format": "table",
                            "items": {
                                "_id": "http://jsonschema.net/signalk/config/server/security/deny/ip/0",
                                "default": "",
                                "description": "",
                                "minLength": 1,
                                "name": "0",
                                "title": "IP address",
                                "type": "string"
                            },
                            "minItems": 0,
                            "name": "ip",
                            "title": "IP Address",
                            "type": "array",
                            "_uniqueItems": true
                        }
                    },
                    "required": [
                        "ip"
                    ],
                    "title": "Black List",
                    "type": "object"
                },
                "white": {
                    "_id": "http://jsonschema.net/signalk/config/server/security/white",
                    "additionalProperties": false,
                    "description": "Always allow from these addresses",
                    "name": "white",
                    "properties": {
                        "ip": {
                            "_id": "http://jsonschema.net/signalk/config/server/security/white/ip",
                            "additionalItems": true,
                            "description": "Allow from IP (eg 192.168.0.1) or network (eg  or 192.186.0.0/24)",
                            "format": "table",
                            "items": {
                                "_id": "http://jsonschema.net/signalk/config/server/security/white/ip/0",
                                "default": "",
                                "description": "",
                                "minLength": 1,
                                "name": "0",
                                "title": "IP address",
                                "type": "string"
                            },
                            "minItems": 0,
                            "name": "ip",
                            "title": "IP Address",
                            "type": "array",
                            "_uniqueItems": true
                        }
                    },
                    "required": [
                        "ip"
                    ],
                    "title": "White List",
                    "type": "object"
                }
            },
            "required": [
                "deny",
                "white",
                "config"
            ],
            "title": "Network Access",
            "type": "object"
        },
        "roles": {
            "description": "Roles and their permissions",
            "format": "categories",
            "properties": {
                "ais": {
                    "description": "AIS allowed keys",
                    "name": "ais",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "AIS",
                    "type": "object"
                },
                "crew": {
                    "description": "Crews allowed keys",
                    "name": "crew",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Crew",
                    "type": "object"
                },
                "friend": {
                    "description": "Friends allowed keys",
                    "name": "friend",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Friends",
                    "type": "object"
                },
                "guests": {
                    "description": "Guests allowed keys",
                    "name": "guests",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Guests",
                    "type": "object"
                },
                "n2k": {
                    "description": "NMEA2000 allowed keys",
                    "name": "n2k",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "NMEA2000",
                    "type": "object"
                },
                "official": {
                    "description": "Official allowed keys",
                    "name": "official",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Official",
                    "type": "object"
                },
                "public": {
                    "description": "Public allowed keys",
                    "name": "public",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Public",
                    "type": "object"
                },
                "serial": {
                    "description": "Serial allowed keys",
                    "name": "serial",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Serial",
                    "type": "object"
                },
                "skipper": {
                    "description": "Skippers allowed keys",
                    "name": "skipper",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Skipper",
                    "type": "object"
                },
                "tcp_external": {
                    "description": "Internet allowed keys",
                    "name": "tcp_external",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Internet",
                    "type": "object"
                },
                "tcp_internal": {
                    "description": "Internal network allowed keys",
                    "name": "tcp_internal",
                    "properties": {
                        "allowed": {
                            "$ref": "#/definitions/allowed",
                            "description": "Allowed keys",
                            "title": "Allowed"
                        },
                        "denied": {
                            "$ref": "#/definitions/denied",
                            "description": "Denied keys",
                            "title": "Denied"
                        }
                    },
                    "title": "Internal network",
                    "type": "object"
                }
            },
            "title": "Roles",
            "type": "object"
        },
        "users": {
            "additionalItems": true,
            "description": "Users and their roles",
            "format": "table",
            "items": {
                "properties": {
                    "email": {
                        "default": "",
                        "description": "The users email ",
                        "examples": [
                            "jb@example.com"
                        ],
                        "title": "Email ",
                        "type": "string"
                    },
                    "hash": {
                        "description": "Hashed password",
                        "options": {
                            "hidden": true
                        },
                        "title": "Hash ",
                        "type": "string"
                    },
                    "lastPasswordChange": {
                        "default": "",
                        "description": "The date the password was last reset",
                        "examples": [
                            "1969-12-31T23:59:59.999Z"
                        ],
                        "title": "Last Changed ",
                        "type": "string"
                    },
                    "name": {
                        "default": "",
                        "description": "The users login name",
                        "examples": [
                            "joe"
                        ],
                        "minLength": 1,
                        "title": "Login",
                        "type": "string"
                    },
                    "password": {
                        "default": "",
                        "description": "The users password",
                        "examples": [
                            "dddcccbbduh"
                        ],
                        "minLength": 8,
                        "title": "Password ",
                        "type": "string"
                    },
                    "roles": {
                        "items": {
                            "default": "",
                            "description": "An explanation about the purpose of this instance.",
                            "enum": [
                                "admin",
                                "skipper",
                                "crew",
                                "guests",
                                "friend",
                                "official",
                                "public",
                                "ais",
                                "serial",
                                "n2k",
                                "tcp_internal",
                                "tcp_external"
                            ],
                            "type": "string"
                        },
                        "title": "Roles ",
                        "type": "array",
                        "_uniqueItems": true
                    }
                },
                "required": [
                    "name",
                    "password",
                    "lastPasswordChange",
                    "roles"
                ],
                "type": "object"
            },
            "minItems": 0,
            "name": "users",
            "title": "Users",
            "type": "array",
            "_uniqueItems": true
        }
    },
    "required": [
        "users",
        "net",
        "roles"
    ],
    "title": "Security Config",
    "type": "object"
}