Enabling Access to End User for the Bold BI Dashboards Through Embedding
Bold BI dashboards can be integrated into your application using JavaScript embedding. This article will guide you on how to embed dashboards when user details are not present in Bold BI but are available in the database (DB) configured with the dashboard, and to embed a dashboard in different modes by adding a user with appropriate permission for the user from embedding application.
Embedding Dashboard in View Mode
To embed a dashboard in view mode when the respective user not present in Bold BI, follow these steps:
-
Use a user email with the appropriate permission in the query parameter “embed_user_email” in the embedded application. The user details to be filtered should be passed through the query parameter “embed_datasource_filter” to embed the dashboard with respective data, make sure this user details are present in the Data source of the respective dashboard.
-
Use the following code to accomplish this:
public string GetDetails([FromBody] object embedQuerString) {
var embedClass = Newtonsoft.Json.JsonConvert.DeserializeObject<EmbedClass>(embedQuerString.ToString());
var embedQuery = embedClass.embedQuerString;
embedQuery += "&embed_user_email=" + EmbedProperties.UserEmail;
double timeStamp = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
embedQuery += "&embed_server_timestamp=" + timeStamp;
embedQuery += "&embed_datasource_filter="+ "[{&userDetail=Alice}]";
var embedDetailsUrl = "/embed/authorize?" + embedQuery + "&embed_signature=" + GetSignatureUrl(embedQuery);
using (var client = new HttpClient()) {
client.BaseAddress = new Uri(embedClass.dashboardServerApiUrl);
client.DefaultRequestHeaders.Accept.Clear();
var result = client.GetAsync(embedClass.dashboardServerApiUrl + embedDetailsUrl).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
return resultContent;
}
}
Embedding dashboard in a different mode when the users aren’t present in Bold BI:
To embed a dashboard in different modes such as design mode, create a dashboard, create a data source, and edit data source, the respective user must be present in the Bold BI application.
During the initial setup of the Bold BI application, an administrative user is created. This user can create additional users within the embedded application via the API. Permissions can then be granted to these users, allowing them to access the embedded dashboard using user-based authorization.
API to Add Users
For on-premise tenants:
- Self-Hosted Server:
https://{yourdomain}/bi/api/site/<site_identifier>/v5.0/users
For cloud tenants:
- Bold BI Cloud Server:
https://{yourdomain}/bi/api/v5.0/users
API to Provide Permission for a Particular User
For on-premise tenants:
- Self-Hosted Server:
https://{yourdomain}/bi/api/site/<site_identifier>/v5.0/permissions/users
For cloud tenants:
- Bold BI Cloud Server:
https://{yourdomain}/bi/api/v5.0/permissions/users
These REST APIs can be effectively used in JavaScript-embedded applications to add users and provide permission to each user individually. So that you can embed the dashboard with respective newly added user.