Seal Report Forum
»
Report Edition
»
Data Source Creation
»
Multi tenant reports with separate database per tenant
Rank: Newbie
Groups: Registered
Joined: 4/22/2022(UTC) Posts: 1
|
We are developing web application, every organization will have different sql database under single sqlserver and each database have same schema.
Also there is one more database with name TenantConfigs that contains details of organization and its database configuration with some master level data.
Can you please help for my below doubts.
1. We need to create same report for all organization but its database connection will be different for every organization.
- is it possible to change database connection from code?
2. Each organization have different users and their role.
- is it possible to add filter on user login and as per their role?
3. While create data source and model we need to add join with our TenantConfigs database. As of now i try to create model in report designer but its only allow me to select one database at a time.
- is it possible to create one data source with multiple database and its tables.
4. We have angular/react as frontend and .net5 api as backend.
- is there anyway to bind report in angular using apis response ?
Thanks in Advance.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Actually you can do what you want if you master the model and code some c# in related scripts. You can use the 'Custom Security Script' (Server Manager -> Configuration -> Configure Web Security...) to initialize your user setting and repository. According to the user logged, you may: Change connection string from the Repository data sources. Add/Remove rights to the user. Add dynamic filters to tables for the users. You may also use the 'Report Execution Init Script' (Server Manager -> Configuration -> Configure Server...) to change dynamically execution behavior. Here are some samples for 'Custom Security Script': Change the connection string: Code: if (user.BelongsToGroup("A_GROUP"))
{
foreach (var source in user.Security.Repository.Sources)
{
source.Connection.MSSqlServerConnectionString += ";Column Encryption Setting=enabled;";
foreach (var connection in source.Connections.Where(i => !string.IsNullOrEmpty(i.MSSqlServerConnectionString)))
{
connection.MSSqlServerConnectionString += ";Column Encryption Setting=enabled;";
}
}
}
Add dynamic security: Code: var metaTable = source.MetaData.Tables.FirstOrDefault(i => i.Name.ToLower() == "a_table_name");
if (metaTable != null)
{
metaTable.WhereSQL = //TODO using metaTable.Name, Helper.QuoteSingle(user.Name)
}
For point 3: You may use a LINQ Data Source, then add 'Table Links' to 1 or other database sources, this allows to perform JOINS at client side using LINQ. For point 4: No experience with angular bit you should check seal interface (https://sealreport.org/demo/WebInterfaceAPI.html) to use pure JS from your browser.
|
|
|
|
Seal Report Forum
»
Report Edition
»
Data Source Creation
»
Multi tenant reports with separate database per tenant
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.