def apply(self, query: Query, value: Any) -> Query: if security_manager.is_admin(): return query filter_set_ids_by_dashboard_owners = ( # pylint: disable=C0103 query.from_self(FilterSet.id).join( dashboard_user, FilterSet.owner_id == dashboard_user.c.dashboard_id).filter( and_( FilterSet.owner_type == DASHBOARD_OWNER_TYPE, dashboard_user.c.user_id == get_user_id(), ))) return query.filter( or_( and_( FilterSet.owner_type == USER_OWNER_TYPE, FilterSet.owner_id == get_user_id(), ), FilterSet.id.in_(filter_set_ids_by_dashboard_owners), ))
def from_self(self, *ent): # override from_self() to automatically apply # the criterion too. this works with count() and # others. return Query.from_self(self.private(), *ent)
def from_self(self, *ent): # override from_self() to automatically apply # the criterion too. this works with count() and # others. return Query.from_self(self.typed(), *ent)
def from_self(self, *ent): # override from_self() to automatically apply # the criterion too. This works with count() and # others. return Query.from_self(self.check_deleted(), *ent)