You've already forked tribes-plugin-kobold
f7e147b8be
CI / Test (push) Failing after 24s
Make Kobold require Trust, declare editable dataset/feature permissions, and enforce generic access rules for remote dataset reads and writes.\n\nUpdate the Docker e2e harness to include Trust and verify handshake-backed public access plus explicit private read/write grants.
137 lines
3.9 KiB
Elixir
137 lines
3.9 KiB
Elixir
defmodule TribeOne.TribesPlugin.Kobold.Plugin do
|
|
@moduledoc """
|
|
Tribes plugin entry point.
|
|
"""
|
|
|
|
use Tribes.Plugin.Base, otp_app: :tribe_one_kobold
|
|
|
|
@impl true
|
|
def register(context) do
|
|
super(context)
|
|
|> Map.merge(%{
|
|
nav_items: [
|
|
%{
|
|
label: "Kobold",
|
|
path: "/kobold",
|
|
icon: nil,
|
|
requires: [],
|
|
order: 50
|
|
}
|
|
],
|
|
pages: [
|
|
%{
|
|
path: "/kobold",
|
|
live_view: TribeOne.TribesPlugin.KoboldWeb.HomeLive,
|
|
layout: nil
|
|
}
|
|
],
|
|
api_routes: [
|
|
{"/", TribeOne.TribesPlugin.KoboldWeb.APIPlug}
|
|
],
|
|
management_methods: [
|
|
%{
|
|
name: "kobold.health",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_health,
|
|
auth: :admin,
|
|
description: "Report Kobold plugin health"
|
|
},
|
|
%{
|
|
name: "kobold.schema",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_schema,
|
|
auth: :admin,
|
|
description: "Report Kobold storage schema readiness"
|
|
},
|
|
%{
|
|
name: "kobold.reset",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_reset,
|
|
auth: :admin,
|
|
description: "Delete Kobold test data for a run"
|
|
},
|
|
%{
|
|
name: "kobold.datasets.create",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_create_dataset,
|
|
auth: :admin,
|
|
description: "Create a Kobold dataset"
|
|
},
|
|
%{
|
|
name: "kobold.resources.create",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_create_resource_definition,
|
|
auth: :admin,
|
|
description: "Create a Kobold resource definition"
|
|
},
|
|
%{
|
|
name: "kobold.records.upsert",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_upsert_record,
|
|
auth: :admin,
|
|
description: "Append a Kobold record upsert event"
|
|
},
|
|
%{
|
|
name: "kobold.state",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_state,
|
|
auth: :admin,
|
|
description: "Read Kobold dataset state"
|
|
},
|
|
%{
|
|
name: "kobold.access.rules.create",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_access_rule_create,
|
|
auth: :admin,
|
|
description: "Create a Kobold access rule"
|
|
},
|
|
%{
|
|
name: "kobold.projections.rebuild",
|
|
version: "1",
|
|
module: TribeOne.TribesPlugin.Kobold.API,
|
|
action: :management_rebuild_projections,
|
|
auth: :admin,
|
|
description: "Rebuild local Kobold projections"
|
|
}
|
|
],
|
|
metrics: [],
|
|
plugs: [],
|
|
hooks: %{},
|
|
access_schema: %{
|
|
title: "Kobold permissions",
|
|
description: "Dataset and feature access rules for Kobold.",
|
|
resources: [
|
|
%{
|
|
type: "kobold.dataset",
|
|
label: "Kobold dataset",
|
|
description: "Controls read/write/admin access to individual Kobold datasets.",
|
|
actions: [
|
|
%{name: "advertise", label: "Advertise"},
|
|
%{name: "read", label: "Read"},
|
|
%{name: "write", label: "Write"},
|
|
%{name: "admin", label: "Admin"}
|
|
]
|
|
},
|
|
%{
|
|
type: "kobold.feature",
|
|
label: "Kobold feature",
|
|
description: "Controls access to plugin-level Kobold features.",
|
|
actions: [
|
|
%{name: "use", label: "Use"},
|
|
%{name: "admin", label: "Admin"}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
})
|
|
end
|
|
end
|