umesh11111 commented on issue #911: unable to list dashboards created by gamma 
users
URL: 
https://github.com/apache/incubator-superset/issues/911#issuecomment-539025998
 
 
   you can use the below code and place this code under the views/core.py file. 
and Gamma user will be able to see his chart .
   
   **Class name is **slicefilter****
   
   
    def apply(self, query, func):  # noqa
           if security_manager.all_datasource_access():
               return query
           perms = self.get_view_menus("datasource_access")
           Dash = models.Dashboard
           User = ab_models.User
           Slice = models.Slice  # noqa
           
           # TODO(bogdan): add `schema_access` support here
           user_roles = [role.name.lower() for role in 
list(self.get_user_roles())]
           datasource_perms = self.get_view_menus("datasource_access")
           all_datasource_access = security_manager.all_datasource_access()
           owner_ids_query = (
               db.session.query(Slice.id)
               .join(Slice.owners)
               .filter(User.id == User.get_user_id())
           )
   
           query = query.filter(
               or_(
                   Slice.id.in_(owner_ids_query),
               )
           )
   
           return query
   
   
   
   
   Let me know if you are facing any problem..
   happy learning

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to