dosubot[bot] commented on issue #28760:
URL: https://github.com/apache/superset/issues/28760#issuecomment-2137225628

   <!-- Answer -->
   The inconsistency in dashboards being shown for some datasets but not for 
others when accessed by a Gamma role user in Apache Superset version 2.1.0 is 
likely due to a permissions issue. Specifically, the fix for this issue is 
mentioned in the changelog:
   
   - [#23118](https://github.com/apache/superset/pull/23118) fix(rbac): show 
objects accessible by database access perm (@villebro)
   
   This fix ensures that objects (such as dashboards) are shown to users based 
on their database access permissions. To resolve this inconsistency, you should 
ensure that the Gamma role has the appropriate database access permissions for 
the datasets in question.
   
   Additionally, the integration tests for dashboard security in Superset 
provide further insights into how permissions are managed. For example, the 
`test_users_can_list_published_dashboard` test ensures that users can view 
dashboards if they have the necessary permissions for the underlying datasets.
   
   Here is a code snippet to check and update the permissions for the Gamma 
role:
   
   ```python
   from superset import security_manager
   
   # Get the Gamma role
   gamma_role = security_manager.find_role("Gamma")
   
   # Ensure the Gamma role has the necessary database access permissions
   databases = security_manager.get_all_databases()
   for database in databases:
       security_manager.add_permission_role(gamma_role, 
security_manager.find_permission_view_menu("database_access", database.perm))
   
   # Commit the changes
   security_manager.get_session.commit()
   ```
   
   This code ensures that the Gamma role has access to all databases, which 
should resolve the issue of dashboards not being shown for some datasets. 
Additionally, you can refer to the integration tests in 
`tests/integration_tests/security_tests.py` for more examples of how 
permissions are handled in Superset. For instance, the 
`test_gamma_user_schema_access_to_dashboards` test verifies that users can list 
published dashboards, ensuring that permissions are correctly applied 
<sup>[[1]](https://github.com/apache/superset/blob/master/CHANGELOG/2.1.0.md)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/tests/integration_tests/dashboards/security/security_dataset_tests.py)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/tests/integration_tests/dashboard_tests.py)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/tests/integration_tests/security_tests.py)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   <details>
   <summary>
   
   #### Details
   </summary>
   
   **About Dosu**
   This response is meant to be useful and save you time. It is **not meant to 
be a precise solution**, but rather a starting point for your own research.
   
   Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is 
irrelevant.
   </details>
   
   *To continue the conversation, mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to