Skip to content

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 : IPlugin

Extends IPlugin

Guide: Core plugins and pages

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.

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.

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.

IReadOnlyList<ITaskPlugin> TaskPlugins { get; }

Task plugins contributed by this core plugin, e.g. PKI contributes “Deploy certificate”.

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).

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.

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).

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).

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.

Task StopAsync(CancellationToken ct)

Called when the server stops and when the plugin is turned off: stop background work and release ports.