You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/08 05:49:38 UTC

[GitHub] [superset] vishalpai commented on issue #12414: Add user role programmatically

vishalpai commented on issue #12414:
URL: https://github.com/apache/superset/issues/12414#issuecomment-1092464776

   Below is what seemed to work for me. Need validation from Superset team if this approach is correct.
   
   For non dynamic permissions e.g., 1. Create a new role that has permissions that are a union of gamma and sql_lab 2. Adding all database access / all data source access / all query access
   - Create a custom security manager
   - Override the sync_role_definitions method
   - In the sync_role_definitions method call the method of the base class
   - Post that write your code to add your role and set permissions
   
   For dynamic permissions e.g., give user access to a specific dataset. This permission has a string like datasource access on DATABASE_NAME][DATASET_ID](id:<SomeNumber>). Value of id is dynamic.
   - Perform same steps as above i.e. create custom security manager, override the same method, call the method of the base class.
   - Create the database and dataset via superset rest api. This will give you the dynamic id.
   - Write your code to add your role and set permissions.
   
   The part that needs validation from Superset team is calling the rest api from the sync_role_defintions method. 
   
   @amitmiran137 could you please help?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org