Implementing translation and privilege check for a link in a custom link widget.

Hi All,

We are trying to group some links based on functionality for which we are trying to use a custom widget. We have configured a custom widget to show a few links on a dashboard and there is a privilege check at a widget level.

The configuration used looks something like -

{
  "id": "customLinks",
  "label": "widget lable",
  "icon": "icon-link",
  "order": 10,
  "extensions": [
    {
      "id": "customLinks.clinicianDashboardSecondColumn",
      "appId": "customLinks",
      "extensionPointId": "formsDashboard.secondColumnFragments",
      "extensionParams": {
        "fragment": "dashboardwidgets/customLinksWidget"
      }
    }
  ],
  "config": {
    "links": {
      "Link One Title": "<the actual link>",
      "Link two Title": "<the actual link>"
    }
  }
}

And I have a couple of questions around this.

  1. Is there a way to show/hide links inside a widget based on privilege?
  2. Is it possible to translate the link title?

Thanks.

@rrameshbtech @mksd @mddubey

Hi @sukreet,

The config provides the link titles to the widget, but not the links themselves? Then where are those configured?

About 2., of course you could localize the links titles, but it depends on the technology used for your widget. Is this GSP?

And same remark about 1., whether your new widget displays something based on some criteria is up to the implementation that you give to it.

Hi @mksd, The links section in the config contains key value pairs, where the key is the link title and value is the url it points to. There is a corresponding gsp for the custom links widget define here.

Oh I see, well it looks like this widget will have to modified so that:

  1. By default the links show for the user carrying the widget’s privilege.
  2. Each link can also be protected by its own ad-hoc privilege, overriding the default.

@mksd We have created the card for translation of the link title and added you as a watcher.

Can you please move the card and assign it to me .