Prohibit or Remove Actions in the Web Report Designer

The Web Report Designer has its own menu with a list of actions for working with projects. For example, new projects can be created, other projects can be opened or saved under a different name:

However, if not all functions are to be available in the Web Report Designer, they can be prohibited. For this purpose, the function OnProvideProhibitedActions() can be used in the implemented controller. There, the class ProhibitedActions can be used to determine which actions are to be prohibited. The function Add() is available for this purpose:

...
public override void OnProvideProhibitedActions(
            ProvideProhibitedActionsContext provideProhibitedActionsContext)
{
  foreach (WebReportDesignerAction action in 
                DefaultSettings.GetProhibitedActions())
  {
    provideProhibitedActionsContext.ProhibitedActions.Add(action);
  }
}
...

The following example shows how to disable the action for the creation of a new project file (“New” button) in the Web Report Designer:

...
public static WebReportDesignerAction[] GetProhibitedActions()
{
  return new WebReportDesignerAction[]
  {
    WebReportDesignerAction.CreateNewProject
    //WebReportDesignerAction.BrowseProjects,
    //WebReportDesignerAction.DeleteProject,
    //WebReportDesignerAction.DownloadProject,
    //WebReportDesignerAction.SaveAsProject,
    //WebReportDesignerAction.SaveProject,
    //WebReportDesignerAction.UnlockProject,
    //WebReportDesignerAction.UploadProject
  };
}
...

As a result, a corresponding message is now displayed in the user interface:

Further actions to be prohibited can be seen in the listing WebReportDesignerAction.

The method Add() has an additional optional bool parameter displayInFrontEnd which can be used to determine that the button in question can be completely removed from the interface for the action to be prohibited. Example:

...
provideProhibitedActionsContext.ProhibitedActions.Add(
                            WebReportDesignerAction.CreateNewProject, false);
...

The button “New” is then no longer available:

1 Like