ReportingException Error for Users with Tenant IDs in Multitenancy Configuration

Topic: ReportingException Error for Users with Tenant IDs in Multitenancy Configuration

Issue Summary:

I’m encountering an issue with the JMIX Reporting and Multitenancy plugins when generating and accessing reports for users with assigned tenant IDs. While users without a specific tenant (Tenant ID set to NULL) can access and download reports successfully, users with an assigned Tenant ID receive an error, preventing them from accessing the reports.

Steps to Reproduce:

  1. Create Report: I created a report in JMIX using the Reporting plugin. For example, the report model lists clients.
  2. Multitenancy Setup: I configured the JMIX Multitenancy plugin and associated the report with roles that can use it.
  3. Assign Screen Access: I ensured the report is accessible on the appropriate screen, adding a button in the client list view to allow report generation and downloading.
  4. Roles and Permissions: Assigned the roles with access to this report and configured the screen where users with those roles can view and interact with it.

Problem:

  • Users without Tenant: Users with Tenant ID set to NULL can access, view, and download the report without issues.
  • Users with Assigned Tenant ID: Users assigned a specific Tenant ID receive the following error when attempting to download the report:

ReportingException: Cannot find report with code clients-report

Expected Outcome:

Users with an assigned Tenant ID should be able to access and download the report in the same way as users without a specific Tenant ID.

Request for Assistance:

Could you please provide guidance on configuring the Reporting and Multitenancy plugins to ensure compatibility for users with assigned Tenant IDs? It seems there might be a configuration or permission issue specific to tenant-based access within the reporting feature.

Thank you for your assistance!
image

Hello!
What is your Jmix version?

Jmix version : 2.3.4

Reports support Multitenancy. So to make a particular report available for User with Tenant, this Report should be created by User with Tenant.
When new Report is saved, it is also saves a tenantId of the current User.
To fix the current error, you can add tenantId manually to the report table to “sys_tenant_id” column.

Thank you for your detailed response.

If I want to create a common report that is accessible to all users (whether they have a specific tenant or not), how should I go about it? Similar to entities where setting a tenantId as NULL allows sharing data across all users, is there a recommended approach for achieving this behavior with reports?

I appreciate your guidance on making this configuration possible.

Best regards,
Abderrahmane Ouhna

To achieve the required behavior it is required:

  1. Disable standard Jmix Multitenancy beans in application.properties:

jmix.core.exclude-beans=mten_HasTenantAdditionalCriteriaProvider, mten_TenantPersistingListener

  1. Modify implementations for Reports entities:
  • AppHasTenantAdditoinalCriteriaProvider
  • AppTenantPersistingListener

Please see the
Sample.zip (1.4 KB)

Please note that this may lead to some unexpected results as this is not the way Multitenancy designed to work.