Changes plugin interface from 'roles' to 'enabled' method for more flexibility
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { UserRole } from "@shared/types";
|
||||
import { Hook, PluginManager } from "~/utils/PluginManager";
|
||||
import config from "../plugin.json";
|
||||
import Icon from "./Icon";
|
||||
@@ -11,6 +12,7 @@ PluginManager.add([
|
||||
group: "Integrations",
|
||||
icon: Icon,
|
||||
component: React.lazy(() => import("./Settings")),
|
||||
enabled: (_, user) => user.role === UserRole.Admin,
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"id": "matomo",
|
||||
"name": "Matomo",
|
||||
"roles": ["admin"],
|
||||
"priority": 40,
|
||||
"description": "Adds support for reporting analytics to a Matomo server.",
|
||||
"deployments": ["community", "enterprise"]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { UserRole } from "@shared/types";
|
||||
import { Hook, PluginManager } from "~/utils/PluginManager";
|
||||
import config from "../plugin.json";
|
||||
import Icon from "./Icon";
|
||||
@@ -11,6 +12,8 @@ PluginManager.add([
|
||||
group: "Integrations",
|
||||
icon: Icon,
|
||||
component: React.lazy(() => import("./Settings")),
|
||||
enabled: (_, user) =>
|
||||
[UserRole.Member, UserRole.Admin].includes(user.role),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
"id": "slack",
|
||||
"name": "Slack",
|
||||
"priority": 20,
|
||||
"roles": ["admin", "member"],
|
||||
"description": "Adds a Slack authentication provider, support for the /outline slash command, and link unfurling."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user