ICorePlugin
Interface in Oadm.Sdk.Plugins · Oadm.Sdk.dll
A service that runs inside the server while it is turned on, usually with a page in the navigation rail (ICorePluginPage in the client part). It can contribute task plugins, actions and events.
public interface ICorePlugin : IPluginExtends IPlugin
Guide: Core plugins and pages
Properties
Section titled “Properties”CorePluginGroup Group { get; }Default implementation
The group of the plugin’s page in the client’s navigation rail (a small group header; empty groups are not shown). Default CorePluginGroup.Extensions.
HasPage
Section titled “HasPage”bool HasPage { get; }Default implementation
False: the plugin has no page in the client’s navigation rail (no rail entry at all); its client part is e.g. a toolbar plugin that calls ICorePlugin.InvokeAsync through IToolbarContext.InvokePluginAsync. Default true.
Permissions
Section titled “Permissions”IReadOnlyList<PermissionDefinition> Permissions { get; }Default implementation
Named rights of this plugin for the permission matrix, e.g. VAPIX Commander “send” and “rollout”. A plugin with a page also gets PermissionKeys.Show automatically (on for Operator, for Viewer on monitoring and reporting pages); declare “show” only to change those defaults, its name and text are the host’s. Empty (the default): the host adds PermissionKeys.Manage for the methods that need UserRole.Admin.
TaskPlugins
Section titled “TaskPlugins”IReadOnlyList<ITaskPlugin> TaskPlugins { get; }Task plugins contributed by this core plugin, e.g. PKI contributes “Deploy certificate”.
ToolArea
Section titled “ToolArea”string? ToolArea { get; }Default implementation
The word the host puts after oadm_ in the names of this plugin’s tools (SDK 0.13.0): “pki” gives oadm_pki_certificates. Lower case letters, digits and underscores. Default null: the plugin’s id without “oadm.” (“oadm.pki” gives “pki”, “oadm.io-monitor” gives “io_monitor”).
IReadOnlyList<PluginTool> Tools { get; }Default implementation
The tools of this plugin (SDK 0.13.0): steps a program such as an assistant may take without the plugin’s page. The host lists them while the plugin is on and the caller’s role has their permission, and calls the plugin’s own ICorePlugin.InvokeAsync with the caller (PluginTool.Method, PluginTool.PreviewMethod), so ICorePlugin.RequiredRole, ICorePlugin.RequiredPermission, ICorePlugin.RequiresAllDevices and the audit of ICorePlugin.IsAudited apply to a tool as to a page method. Default: none.
Methods
Section titled “Methods”AuditDetail
Section titled “AuditDetail”string? AuditDetail(string method, string? payloadJson)Default implementation
SDK 0.10.0: what the audit entry of an audited call (ICorePlugin.IsAudited) says instead of the method name, read after the call ended (“Pressed Open gate on Gate house”); null (the default) = the method. Never a secret. The host adds “ (failed)” for a call that threw and “ (cancelled)” for one the client gave up, so the text must not rely on the call having worked.
InvokeAsync
Section titled “InvokeAsync”Task<string?> InvokeAsync(string method, string? payloadJson, CancellationToken ct)Backend for the plugin’s UI page (or, without a page, for its client parts such as a toolbar button).
InvokeAsync
Section titled “InvokeAsync”Task<string?> InvokeAsync(ICallContext caller, string method, string? payloadJson, CancellationToken ct)Default implementation
The page backend with the user’s call (SDK 0.4.0): who calls and the devices the user may reach. Implement this overload and use caller for devices, VAPIX, tasks and event streams; the default forwards to ICorePlugin.InvokeAsync. The host calls this one. A package built against an older SDK (plugin.json minSdkVersion below 0.4.0) is refused for users with a device group before it runs.
IsAudited
Section titled “IsAudited”bool IsAudited(string method)Default implementation
Whether a call of method is written to the server’s audit log (user, client, plugin, method). Default: the methods that need UserRole.Admin.
RequiredPermission
Section titled “RequiredPermission”string? RequiredPermission(string method)Default implementation
The permission a user needs to call method: a key of ICorePlugin.Permissions, or PermissionKeys.Show. Null (the default) falls back to ICorePlugin.RequiredRole: Operator methods need “show” (or only a login for a plugin without a page), Admin methods need “manage”. An unknown key or an exception means Administrator only (fail closed).
RequiredRole
Section titled “RequiredRole”UserRole RequiredRole(string method)Default implementation
The role a user needs to call method through the plugin’s page (PluginService.Invoke). The host checks it before ICorePlugin.InvokeAsync and answers PERMISSION_DENIED for a missing role. Methods that change the server’s configuration (settings, keys, services) return UserRole.Admin; reads and device work stay UserRole.Operator (the default).
RequiresAllDevices
Section titled “RequiresAllDevices”bool RequiresAllDevices(string method)Default implementation
True for methods only users with all devices may call (SDK 0.4.0): saves of server-wide services (NTP, DHCP, PKI and EST settings, a shared command library). The host refuses them for users with a device group before the plugin runs (“Only users with all devices can do this.”). Also asked for downloads. Default false.
SelfCheck
Section titled “SelfCheck”string? SelfCheck(string pluginDirectory)Default implementation
--self-check of the published server (SDK 0.12.0): proves that what this plugin needs at run time really works, such as a native library or a model it ships. No device, no network, no change. Null when all is well, else the problem in plain words.
Parameters
pluginDirectory: The plugin’s folder.
StartAsync
Section titled “StartAsync”Task StartAsync(ICorePluginContext ctx, CancellationToken ct)Called when the server starts and when an administrator turns the plugin on. Keep ctx for later. Return fast: never wait for a device or the network here, start background work instead.
StopAsync
Section titled “StopAsync”Task StopAsync(CancellationToken ct)Called when the server stops and when the plugin is turned off: stop background work and release ports.
SystemAccessReason
Section titled “SystemAccessReason”string? SystemAccessReason(string method)Default implementation
Why method needs ICorePluginContext.System (every device) during the call of a user with a device group, e.g. “counts every device, shows no device data”; null (the default) = it does not, and ctx.System refuses there like ctx.Devices. Keep the list short: the canary test prints it.