Add capability check when adding plugin entries to admin nav

So far, when adding entries for plugins to the admin navigation, they
were always visible for all logged in users. In some cases, this might
not be desirable.

This change adds an optional parameter to the AdminApi().addMenuLink()
API for plugins, that allows to set a capability a user must have to see
the menu entry. If no capability is set, the menu entry will be visible
to all logged in users as before.

Change-Id: I463d6ec8b9fcf360318255f7785bdf8cc52b00bb
This commit is contained in:
Thomas Draebing
2019-08-22 16:46:39 +02:00
committed by David Pursehouse
parent e46d5ae7fd
commit 7880b0bc64
6 changed files with 73 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ This API is provided by link:pg-plugin-dev.html#plugin-admin[plugin.admin()]
and provides customization of the admin menu.
== addMenuLink
`adminApi.addMenuLink(text, url, opt_external)`
`adminApi.addMenuLink(text, url, opt_external, opt_capabilities)`
Add a new link to the end of the admin navigation menu.