Hi,
I have a dashboard with 5 tabs which is assigned to a workflow step.
One of the tab has a cube view where assumptions are inputted. I want this tab to be visible only for administrators and n...
Hi Shubham0512: this can be accomplished but requires the use of DynamicDashboard components. Instead of adding the subdashboards directly to your tabbed dashboard in the GUI. You'll add them via code in the DynamicDashboard assembly. In the code you'll perform the check for Admin/SecurityGroup and only add your last dashboard if the user meets the requirement.
You'll need:
A dashboard that is type = Embedded Dynamic Repeater. Its only component is a manually created Embedded Dashboard
The manually created Embedded Dashboard will have your template parameters that control the display name (tab name) and a reference to the actual sub dashboard components to use
A DynamicDashboard assembly that controls which tabs to display
Sample code for adding the tabs.
#Region "Dynamic Tabs based on Access Group"
If storedDashboard.Name.XFEqualsIgnoreCase("1_HT_TabsDynamic") Then
'#### Create Repeat Args = Collection ####
Dim repeatArgs As New List(Of WsDynamicComponentRepeatArgs)
'#### Tabs for Everyone ####
repeatArgs.Add(New WsDynamicComponentRepeatArgs("Tab1", New Dictionary(Of String, String) From {
{"DisplayName", "Hello World"},
{"DashboardName", "HT_Tab1"}
}))
repeatArgs.Add(New WsDynamicComponentRepeatArgs("Tab2", New Dictionary(Of String, String) From {
{"DisplayName", "Second"},
{"DashboardName", "HT_Tab2"}
}))
'#### Tabs Only for Security Group ####
If BRApi.Security.Authorization.IsUserInGroup(si, si.UserName, "FakeAccessGroupForDemo", True) Then
repeatArgs.Add(New WsDynamicComponentRepeatArgs("Tab3", New Dictionary(Of String, String) From {
{"DisplayName", "ADMIN ONLY"},
{"DashboardName", "HT_AdminOnly"}
}))
End If
'#### Create the dashboard ####
Dim thisDashboard As WsDynamicDashboardEx = api.GetEmbeddedDynamicDashboard(si, _
workspace, parentDynamicComponentEx, _
storedDashboard, String.Empty, Nothing, _
TriStateBool.Unknown, WsDynamicItemStateType.Unknown)
'Add our Collection of repeated things to it
thisDashboard.DynamicDashboard.Tag = repeatArgs
'Return this object
Return thisDashboard
End If
#End Region
Screenshots
Example components:
The Embedded Dashboard component:
Output of the view all users see:
Output of the view authorized users see:
All the assembly stuff is on the advanced side, so if you are new to it try following some of the guides/samples in the documentation before working on your actual components. Good luck!