Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Oct 24, 2022
  2. Oct 21, 2022
    • Cam Saul's avatar
      Add `created_at` to Collection (#25871) · 7af4f706
      Cam Saul authored
      * Add created_at to Collection
      
      * Simplified migrations [ci skip]
      
      * Add SQL for H2 and MySQL; add tests
      
      * Sort namespaces
      
      * Test fixes :wrench:
      
      * Test fixes
      
      * Test fixes :wrench:
      
      * Make sure MySQL/MariaDB Liquibase generator sets the current timestamp function for ADD COLUMN
      7af4f706
    • Braden Shepherdson's avatar
      Serdes v2: Refactor entire serdes flow to use real Toucan, not low level (#25981) · a9f44010
      Braden Shepherdson authored
      Previously, some automatic behavior was causing problems in serdes.
      (The worst example is generating an `entity_id` on insert while
      deserializing an entity we don't own - if deserialized again it would be
      duplicated.)
      
      A whole cascade of design choices fell out of this problem:
      - `insert!` would generate `entity_id`s, so use `simple-insert!`
      - But `simple-insert!` doesn't convert eg. MBQL `:definition` maps back
        into JSON strings
      - We got the maps as Clojure data and not JSON strings because `select`
        and `simple-select` both run `post-select` and parse the JSON.
      - So we ended up with a raw query on the select side and `simple-insert!`
        on the storage side.
      
      This change unwinds that whole stack, and instead uses a dynamic
      var to suppress the few pieces of `pre-insert` and `pre-update` logic
      that causes problems.
      
      The end result is much cleaner, and much more consistent with the rest
      of Metabase's backend logic.
      a9f44010
  3. Oct 19, 2022
    • Case Nelson's avatar
      [Apps] Remove emitters (#25999) · f5a9ea85
      Case Nelson authored
      * [Apps] Remove emitters
      
      Emitters were created when we thought that we would be adding actions to
      multiple places in metabase. Instead we've coalesced to actions being a
      core feature of data-apps and are executed from within them. Attaching
      actions to models, as a form of re-use rather than a form of execution,
      means that actions can still be executed directly from a model, if we
      want to allow that in the future.
      
      * Fix lint errors
      
      * Move perform-action! tests out of the api.
      
      Since we want to keep the implicit bulk functionality but remove those
      endpoints move the tests to the actions namespace.
      
      * Fix linter
      
      * Change driver test to use function instead of endpoint
      f5a9ea85
    • metamben's avatar
      Remove data app permission code (#26016) · b8c92cf1
      metamben authored
      * Revert "Use "apps" collection namespace for app collections (#25963)"
      
      This reverts commit a1894202.
      
      * Revert "Implement EE/Pro app permissions (#25764)"
      
      This reverts commit cf9b1bf5.
      
      * Revert "Implement global app permissions for the "All Users" group (#25679)"
      
      This reverts commit 63e950f2.
      
      * Revert "Require data permissions for executing actions (#25784)"
      
      This reverts commit 732bf6b1.
      
      * Revert "Prevent modifying app permissions via the collection endpoint (#25684)"
      
      This reverts commit 5d3f8279.
      
      * Revert "Implement DB specific execution permissions (#25629)"
      
      This reverts commit 141a13ce.
      
      * Revert "Introduce /execution/ permission (#25529)"
      
      This reverts commit 57cbb921.
      
      * Keep the app permission revision table
      b8c92cf1
    • metamben's avatar
      Revert "Prevent repeated coercion of fields (#24718)" (#26004) · 1e4d8bdd
      metamben authored
      This reverts commit 23666516.
      1e4d8bdd
    • metamben's avatar
      Use "apps" collection namespace for app collections (#25963) · a1894202
      metamben authored
      * Create app collections in the "apps" collection namespace
      
      * Add test macro for setting global app permissions for "All Users"
      
      * Introduce app permission audit table
      a1894202
  4. Oct 17, 2022
  5. Oct 14, 2022
    • Dalton's avatar
      Move more parameters utils to metabase-lib (#25900) · 0b118bd2
      Dalton authored
      * Move subset of parameter-values utils to metabase-lib
      
      * Move parameter mbql utils to metabase-lib
      
      * Create some small target utils
      
      * Move template tag utils to metabase-lib
      
      * Move target/field logic to metabase-lib
      
      * Remove eslint-enable
      0b118bd2
  6. Oct 12, 2022
    • Cam Saul's avatar
      Add CLI SerDes command for seeding entity IDs (#25655) (#25870) · ad103807
      Cam Saul authored
      * Add CLI SerDes command for seeding entity IDs (#25655)
      
      * Remove stray comment
      
      * Fix Kondo error
      
      * Fix Eastwood error
      
      * Update identity-hash-fields to multimethod for ModelAction
      
      * Fix identity-hash-fields for Dimension and DashboardCardSeries
      ad103807
    • Braden Shepherdson's avatar
      Serdes v2: Improved selective serialization; several fixes for Stats (#25834) · b64e3d65
      Braden Shepherdson authored
      These changes resulted from the effort to serialize and deserialize some
      collections from our internal Stats instance, which did not
      (de)serialize correctly out of the box.
      
      The main improvement is more robust "escape" analysis - making sure that
      all dashboards, cards, models, etc. required by the curated collections
      actually belong to those curated collections. (Many cards on Stats were
      actually in people's personal collections and publicly readable - that
      doesn't work with the curated git workflow.)
      
      This adds some new tests, trying to capture some complex MBQL queries
      and make sure they're correctly (de)serialized.
      b64e3d65
    • Noah Moss's avatar
      Fix a serialization test by not hardcoding tmp directory (#25880) · 09f98f6f
      Noah Moss authored
      * fix serialization test by not hardcoding tmp directory
      
      * clean imports
      
      * cleanup
      
      * change approach
      09f98f6f
  7. Oct 07, 2022
  8. Oct 04, 2022
  9. Sep 30, 2022
    • Nemanja Glumac's avatar
      [FE] Remove unused `underscore` imports (#25709) · e8526c75
      Nemanja Glumac authored
      * Remove unused `underscore` imports from `.ts` files
      
      * Remove unused `underscore` imports from `.tsx` files
      
      * Remove unused `underscore` imports from `.jsx` files
      
      * Remove unused `underscore` imports from `.js` files
      e8526c75
  10. Sep 29, 2022
  11. Sep 28, 2022
  12. Sep 27, 2022
  13. Sep 26, 2022
    • metamben's avatar
      Implement DB specific execution permissions (#25629) · 141a13ce
      metamben authored
      * Implement DB specific execution permissions
      
      Separate execution permissions from data permissions as a new dimension
      like application features. Create a new endpoint for getting and setting
      these permissions.
      141a13ce
    • Nemanja Glumac's avatar
      feaac122
    • dpsutton's avatar
      Substitute persisted queries in parameter card references (#25610) · 1ebae228
      dpsutton authored
      * Substitute persisted queries in parameter card references
      
      ```sql
      select o.total, o.quantity, model_p.category, model_p.title
      from orders o
      left join {{#14-pg-products}} model_p -- reference to products model
      on o.product_id = model_p.id
      limit 4
      ```
      
      Testing:
      
      I'm unhappy with how verbose the test is. At some point we're going to
      need a better, standardized way to test persistence. But the test makes
      a persisted table of the test-data.categories
      table (test/metabase/test/data/dataset_definitions/test-data.edn). It
      runs some sql to update the values in the table to turn `"Winery"` ->
      `"Winery from cached table"`, joins the two tables together to have both
      at once.
      
      There's a lot of moving pieces and the setup is a bit verbose. There's
      also no obvious place where these types of tests should go. We'll need
      to consolidate them in the future (and extend them).
      
      * persisted macro
      
      * docstring for `persisted-info-native-query`
      
      * alignments and small nits
      
      * Reuse persistence macro
      
      * clj-kondo cleanups
      
      * remove clj-kondo change before rebase
      1ebae228
  14. Sep 23, 2022
  15. Sep 22, 2022
    • Cam Saul's avatar
      Enable kondo unused bindings linter in tests (#25120) · 401edd07
      Cam Saul authored
      * 347 errors, 34 warnings
      
      * 89 errors, 66 warnings
      
      * 63 errors, 39 warnings
      
      * 52 errors, 33 warnings
      
      * 23 errors, 22 warnings
      
      * 13 errors, 4 warnings
      
      * Fix the last few errors.
      
      * Sort Kondo config
      401edd07
    • Noah Moss's avatar
      Backend for Google Sign-In setup improvements (#25519) · 35d7f846
      Noah Moss authored
      * wip changes
      
      * new endpoint
      
      * fix test
      
      * more test fixes
      
      * add test for EE settings permissions
      
      * try to fix another BE test
      
      * address ngoc's comment
      
      * fix cypress test
      
      * fix another cypress test to hit new settings endpoint
      35d7f846
  16. Sep 19, 2022
    • dpsutton's avatar
      Don't use persisted model tables for segmented users (#25347) · 32403f0d
      dpsutton authored
      * Don't use persisted model tables for segmented users
      
      This actually isn't a bug, but due to very subtle and arbitrary reasons.
      
      For background about why we need to ensure this never happens, we cannot
      use persisted models when sandboxing is at play. A simple example is as
      follows: make a model on a products table that does not select the
      category. Have a sandbox on category such that someone can only see
      products of category "Gizmo". the model lacks the category column but we
      insert a where clause that still works. When the model is persisted,
      there is no category column in the underlying table so sandboxing cannot
      possibly work: the data necessary to filter is no longer associated with
      the rest of the data in the model.
      
      The fix for this is quite simple: in
      `metabase.query-processor.middleware.fetch-source-query` we only splice
      in the persisted query if the user is not a segmented user (product name
      for sandboxing).
      
      ```clojure
      (and persisted-info/*allow-persisted-substitution*
           (not (segmented-user?))  ;; <----- new check
           (:active card)
           (:definition card)
           (:query_hash card)
           (= (:query_hash card) (persisted-info/query-hash (:dataset_query card)))
           (= (:definition card) (persisted-info/metadata->definition (:result_metadata card)
                                                                      (:table_name card)))
           (= (:state card) "persisted"))
      ```
      
      Technical details about why this bug did not manifest
      
      When swapping out a card__<id> to a source query, if its a model we will
      see if it is persisted, and if so, we will use the native sql to select
      from the persisted table. It does this by adding the native sql at a key
      called `:persisted-info/native` and a middleware
      `#'qp.persistence/substitute-persisted-query` walks the query replacing
      the query with the native:
      
      ```clojure
      ;; metabase.query-processor.middleware.persistence
      
          (mbql.u/replace query
            (x :guard (every-pred map? :persisted-info/native))
            {:native (:persisted-info/native x)})
      ```
      
      There is also a middleware that walks through the query looking for
      tables with gtaps on them and replacing them. By change, the sandboxing
      middleware runs immediately before the substitute-persisted middleware!
      
      ```clojure
         ;; literally the previous middleware
         (resolve 'ee.sandbox.rows/apply-sandboxing)
         #'qp.persistence/substitute-persisted-query
      ```
      
      If you swap the order of these two sandboxing is broken. As is, it
      "works" but not by design, just by happenstance. The sandboxing
      middleware just did not know that the `:persisted-info/native` key meant
      that a native query was to be substituted. In the reverse order, the
      native query is already substituted and there is no change for the
      sandboxing to occur.
      
      The obvious fix is to ensure that we never even attempt to use the
      persisted tables and that is what this PR does.
      
      * Eastwood doesn't like shadowing like this
      
      * Rearrange check order for tests
      
      `segmented-user?` throws if there is no bound user. A test in
      `fetch-source-query-test` was failing because there was no user bound,
      but it wasn't attempting to swap out a persisted table, it just didn't
      expect to need a user.
      
      Moving it lower lets it short circuit on other bits that are bound to
      fail (definition, query_hash, etc) requiring persistence before we check
      for a bound user
      32403f0d
    • Noah Moss's avatar
      LDAP setup improvements (#25421) · b18d53e8
      Noah Moss authored
      
      * first pass at LDAP setup improvements
      
      * fix lint errors
      
      * fix LDAP api tests
      
      * WIP test for new setting setter
      
      * fix setting test
      
      * set ldap-enabled to true in ldap server macro
      
      * try to fix java11 tests
      
      * Update src/metabase/integrations/ldap.clj
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      
      * add transaction
      
      * remove ldap-ever-enabled? setting and revert some of the logic that is no longer necessary
      
      * set ldap-enabled via the ldap api and add tests
      
      * fix tests and lint
      
      * fix error on settings save
      
      * fix cypress test
      
      * actually fix cypress
      
      Co-authored-by: default avatarmetamben <103100869+metamben@users.noreply.github.com>
      b18d53e8
  17. Sep 15, 2022
  18. Sep 14, 2022
  19. Sep 12, 2022
  20. Sep 06, 2022
  21. Aug 31, 2022
Loading