Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Jun 02, 2022
    • adam-james's avatar
      Adjust JWT and SAML fetch-and-update user to save new attributes (#23005) · 174afe58
      adam-james authored
      * Adjust JWT and SAML fetch-and-update user to save new attributes
      
      Before this change, JWT/SAML logins would attempt to update attributes, but never considered the first-name or
      last-name attributes.
      
      * Attempts to fix tests to prevent pulluting test users with "Unknown"
      
      * No deleting users.
      
      * Unit tests checking that first/last names are updated for SSO users
      
      When an SSO user is first logged in, they might not have first_name and/or last_name keys. This is allowed, but the
      names will be "Unknown" in the app-db. Subsequently, a User may log in again with SSO but have fisrt/last name
      attributes, which should update the Metabase user data in the app-db.
      
      These unit tests set up such a scenario to check that the :first_name and :last_name keys are indeed updated.
      
      * Adjust Enterprise LDAP to also use SSO-UTILS
      
      Trying to unify the LDAP implementation with JWT/SAML a bit here.
      
      * Lint error
      
      * Reverting LDAP ns changes to get the PR unstuck
      
      This is to keep the ball rolling on SSO fixes. I'll add LDAP as an item in the Epic to address this separately.
      Unverified
      174afe58
  2. May 30, 2022
  3. May 19, 2022
  4. May 16, 2022
    • Case Nelson's avatar
      Persist auto enable (#22756) · c5a31c48
      Case Nelson authored
      
      * Auto enable persistence for models
      
      When persistence is turned on for a db, we want to enable persistence
      caching for all models in the db.
      
      We do this by finding any models without a PersistentInfo at the top of
      the scheduled refresh task and creating one that will get picked up by
      the refresh.
      
      This necessitated introducing another "off" state on PersistedInfo that
      will get set from the front end, manually disabling persistence on a
      model.  This turns PersistedInfo into a marker so that when the refresh
      task runs again, these models will not be turned back on.
      
      The prune job will prune "off" or "deletable" PersistedInfo. Since we don't
      have a second "off-ing" state; the prune job will "drop if exists" the
      cache table each time. This may need to change.
      
      * Cherry-pick persist-refresh changes from persist-refresh-fail-email
      
      * Ready models when enabling persistence on db
      
      * Handle automatic model persistence in Tools table
      
      * Address review: insert-many instead of  doseq insert
      
      Co-authored-by: default avatarAnton Kulyk <kuliks.anton@gmail.com>
      Unverified
      c5a31c48
    • Noah Moss's avatar
  5. May 13, 2022
    • Case Nelson's avatar
      Update persist model api permissions for EE (#22601) · f302d582
      Case Nelson authored
      * Update persist model api permissions for EE
      
      On OSS, only Admins can enable model cache in `Settings/Cache`,
      enable database model cache in `Settings/Databases` and cache individual models.
      
      On EE/Pro, users with `Settings access` application permissions can enable model
      cache in `Settings/Cache` and users with `Manage database` can enable model
      cache for a database.
      
      * Add tests for application permissions
      Unverified
      f302d582
    • Howon Lee's avatar
      No open redirects for enterprise SSO's (#22622) · f3f9c627
      Howon Lee authored
      Open redirects means doing some sso with a built-in redirect, and redirecting into an unhappy place (aka, a non-MB place) afterwards so that someone gets phished or other bad things happen. This is already prevented for OSS sso's but not EE - prevents this for EE sso's by forcing redirects to be in MB `site-url` set domain.
      Unverified
      f3f9c627
  6. May 11, 2022
  7. May 09, 2022
  8. May 06, 2022
  9. Apr 29, 2022
  10. Apr 28, 2022
  11. Apr 27, 2022
    • Noah Moss's avatar
      `defenterprise` macro (#21672) · 8f9b5957
      Noah Moss authored
      * scaffolding, docstring & arg parsing
      
      * tweaks
      
      * registry and basic oss->ee dispatch
      
      * stubbed defenterprise-ee
      
      * full defenterprise-ee impl
      
      * fix build and tweak docstring
      
      * remove debug code
      
      * basic tests
      
      * use defonce
      
      * support for :any feature
      
      * schema support
      
      * fix schema test
      
      * switch to using format
      
      * support for schema on return val
      
      * tweak macro
      
      * move schema validation to submacros
      
      * do ee fn resolution at runtime
      
      * do conditionals at macro-expansion time
      
      * adjust semantics & refactor
      
      * fix test
      
      * add memoization for ee resolution
      
      * fix tests
      
      * emit register-mapping! call to avoid eval
      
      * call starts-with on symbol
      
      * remove schema support
      
      * use spec for arg parsing, generate fns, and remove :error fallback option
      
      * clean ns
      
      * change schema alias to schema
      
      * add :arglists meta and small refactor
      
      * refactor
      
      * move EE logic to fn
      
      * validate that the correct args are passed in EE/OSS namespaces, and make :feature required
      
      * remove logic for handling nil :feature
      
      * fix lint errors
      
      * fix ee macros
      
      * defenterprise-schema macro & tests
      
      * clean ns
      
      * propogate metadata
      
      * don't memoize ee resolution in dev to make debugging easier
      
      * dont do ee fn resolution during macroexpansion
      
      * minor refactor and cleanup
      
      * major refactor
      
      * update docstrings
      
      * more docstring tweaks
      
      * try to fix lint error on ldap PR
      
      * use dan's suggestion
      Unverified
      8f9b5957
  12. Apr 22, 2022
    • Ngoc Khuat's avatar
      Make /api/user works with Group managers (#21794) · 3675e8b4
      Ngoc Khuat authored
      
      * Make /api/user works with Group manager
      
      * add tests
      
      * fix linting
      
      * hope clj-kondo is happpy now
      
      * update docs
      
      * nit
      
      * GET /api/user/:id returns user_group_memberships and allow group manager
      
      * return additional fields if caller is Group Manager
      
      * fix ns
      
      * use set instead of list in tests
      
      * POST /api/user/:id takes user_group_memberships too
      
      * address Noah's comments
      
      * typo
      
      * sort by superuser -> group managers -> normal user when filter by group-id
      
      * FE: Group managers  (#21111)
      
      * group managers ui
      
      * update specs
      
      * review
      
      * review
      
      * fix merge
      
      Co-authored-by: default avatarAlexander Lesnenko <alxnddr@users.noreply.github.com>
      Co-authored-by: default avatarAleksandr Lesnenko <alxnddr@gmail.com>
      Unverified
      3675e8b4
  13. Apr 21, 2022
  14. Apr 19, 2022
    • Braden Shepherdson's avatar
      Make namespace aliasing consistent everywhere; enforce with clj-kondo (#21738) · 19beda53
      Braden Shepherdson authored
      * Make namespace aliasing consistent everywhere; enforce with clj-kondo
      
      See the table of aliases in .clj-kondo/config.edn
      
      Notable patterns:
      - `[metabase.api.foo :as api.foo]`
      - `[metabase.models.foo :as foo]`
      - `[metabase.query-processor.foo :as qp.foo]`
      - `[metabase.server.middleware.foo :as mw.foo]`
      - `[metabase.util.foo :as u.foo]`
      - `[clj-http.client :as http]` and `[metabase.http-client :as client]`
      
      Fixes #19930.
      Unverified
      19beda53
  15. Apr 18, 2022
    • Noah Moss's avatar
      Fixes to DB and data model perm enforcement for users without data perms (#21699) · 89d75060
      Noah Moss authored
      
      * fix DB perm enforcement for users without data perms
      
      * update table perm checks
      
      * fix output of helper fn
      
      * revise approach
      
      * fix table read path
      
      * remove blank line
      
      * refactor and cleanup
      
      * syntax fix
      
      * add tests
      
      * fix test
      
      * another test
      
      * typo
      
      * fix more tests
      
      * make perm test helper more robust to fix final test failures
      
      * clean ns
      
      * grant read perms for a DB if a user has only data model perms, using a special :data-model perms object set
      
      * Revert "grant read perms for a DB if a user has only data model perms, using a special :data-model perms object set"
      
      This reverts commit f6cb724e513f6be5a26bc7252ffea30c192dfc8b.
      
      * change exclude-uneditable-data-model? to include-editable-data-model?
      
      * also adjust behavior & flag on /api/database/:id/metadata
      
      * update FE data model flags
      
      * one more datamodel fe query param
      
      * also add include_editable_data_model flag to /api/database/:id
      
      * a couple of more places for new query params
      
      * add include_editable_data_model query parameter to data model page requests
      
      * fix variable name
      
      * docstring fixes
      
      * fix test helper
      
      * fix perm check in /api/database/:id
      
      * try to fix cypress test
      
      Co-authored-by: default avatarAleksandr Lesnenko <alxnddr@gmail.com>
      Unverified
      89d75060
    • Maz Ameli's avatar
      Tweaks to permissions strings (#21704) · d0f3fea4
      Maz Ameli authored
      
      * change the General permissions to Application
      
      * rename general permissions to application permissions
      
      * BE: Rename General Perms to Application Perms (#21709)
      
      * BE: Change General Perms to Application Perms
      
      * lint migration file
      
      * add migration to update seq name
      
      * update application perms graph endpoint in fe
      
      Co-authored-by: default avatarAleksandr Lesnenko <alxnddr@gmail.com>
      Co-authored-by: default avatarNgoc Khuat <qn.khuat@gmail.com>
      Unverified
      d0f3fea4
  16. Apr 15, 2022
    • Ngoc Khuat's avatar
      BE: Group Manager - Permissions enforcement (#21554) · d3807aff
      Ngoc Khuat authored
      
      * add is_group_manager and hydrate it
      
      * update test title
      
      * fix namespaces and 1 test
      
      * update docstring and make sure the is-group-manager? is converted to boolean in any db
      
      * even more docstring
      
      * fix ns
      
      * Fix a test appeared when merge with master
      
      * add tests and more api enforcement
      
      * appease linter and make sure the test can run in ee
      
      * update by membership id
      
      * one dot
      
      * update docs
      
      * make is_group_manager optional
      
      * hydrate is_group_manager when get single group
      
      * - Split the `check-group-manager` into 2 functions
      - Address Noah's comments
      
      * Update enterprise/backend/test/metabase_enterprise/advanced_permissions/api/group_manager_test.clj
      
      Co-authored-by: default avatarNoah Moss <32746338+noahmoss@users.noreply.github.com>
      
      * change is_group_manager in to bool instead of boolstring
      
      * remove debug code
      
      Co-authored-by: default avatarNoah Moss <32746338+noahmoss@users.noreply.github.com>
      Unverified
      d3807aff
  17. Apr 14, 2022
    • Ngoc Khuat's avatar
      BE: Enforce Monitoring Permissions APIs (cont) (#21630) · 8cd304ad
      Ngoc Khuat authored
      * disallow adding recipients by non-admins with monitoring permission
      
      * enforce sharing and embedding apis
      
      * enforce update monitoring perms for alert, pulse and tasks API
      
      * add minor test cases
      
      * remove debug code
      
      * linting
      
      * fix  not able to remove users from pulse and make sure our tests cover that case
      
      * address Noah's comments
      
      * one space
      Unverified
      8cd304ad
  18. Apr 13, 2022
  19. Apr 12, 2022
  20. Apr 10, 2022
  21. Apr 08, 2022
  22. Apr 07, 2022
    • Noah Moss's avatar
      Data model permission enforcement part 2 (#21475) · e86e80ad
      Noah Moss authored
      * add can_access_data_model key to api/user/current
      
      * add exclude_uneditable flag to /api/database/:id/metadata
      
      * clean ns
      
      * WIP figuring out how to update perm checks for Field model
      
      * fix errors
      
      * fix more errors
      
      * tests for field APIs
      
      * table perms changes
      
      * tests for table API
      
      * fix function call
      
      * clean ns
      
      * perm enforcement for other table APIs
      
      * perm enforcement for other field APIs
      
      * address comments
      Unverified
      e86e80ad
    • Ngoc Khuat's avatar
      Fix SSO failed to sync admin group (#20991) · 0708ce0a
      Ngoc Khuat authored
      * fix failed to sync admin group
      
      * address noah's comments and add migration script
      
      * document for run-with-data-migration-index
      
      * update comments
      
      * fix name space
      
      * adding data_migrations tests
      
      * add docg
      
      * make sure we don't remove admin group if sso and ldap are not configured
      
      * fix tests for be-ee
      
      * fix tests for oss
      
      * misc docs updates
      
      * remove data-migration-index
      
      * return some newlines
      
      * is it failling here?
      
      * update data_migration docs
      
      * update data_migration docs
      
      * fix all styling comments
      
      * make migration to run both in oss and enterprise and make sure the tests are accounted for that
      
      * fix failed namespace checks
      
      * Add a comment to the test
      
      * fix per comments
      
      * Update permissions.clj
      
      * tweaking with the :warning: icon
      
      * refactor with-temporary-raw-setting-values
      
      * update comments
      
      * Add extension for cert file
      
      * address Noah's comments
      Unverified
      0708ce0a
  23. Apr 06, 2022
  24. Apr 05, 2022
    • Cam Saul's avatar
      Clear out existing DashboardCards when running `load` with `--mode update` (#21241) · f63aa430
      Cam Saul authored
      * Clear out existing DashboardCards when running load with --mode update
      
      * Namespace cleanup
      
      * Fix circular references
      
      * Another test fix
      
      * Settings cache needs to be per-app-DB
      
      * (Experimental -- new application DB dynamic var)
      
      * Create truly rebindable `metabase.db.connection/*application-db*`
      
      * call-on-change-fn -> call-on-change
      
      * Revert unneeded commit
      
      * Namespace cleanup
      
      * Add missing docstrings
      
      * Appease linters again
      
      * Fix handler stats logging middleware
      
      * PR feedback
      
      * PR feedback: slight optimization
      
      * Remove NOCOMMIT
      
      * PR feedback
      
      * Clean namespace
      Unverified
      f63aa430
  25. Apr 04, 2022
  26. Apr 01, 2022
    • Noah Moss's avatar
      QP middleware for download perms (#21021) · 04473fc5
      Noah Moss authored
      Unverified
      04473fc5
    • Ngoc Khuat's avatar
      Grant Subscription permission by default (#21179) · e36304ec
      Ngoc Khuat authored
      * add API to fetch general permisisons graph
      
      * add API to update general permissionns
      
      * change author of migration
      
      * update documents
      
      * misc fixes to applease the CIs
      
      * Add tests for general permission APIs and models
      
      * linting and fix a failed test case
      
      * fix some failed tests
      
      * update docs and change /subscription/ to /general/subscription/ for consistency
      
      * Hook and migration to make sure subscription are created for new groups by default
      
      * add schema migrations tests
      
      * set for the win
      
      * address noah's comments
      
      * Parse number as is in http-client for tests
      
      * address Cam's comments
      
      * revert the last commit about parsing API response in tests
      
      * change fk name
      
      * delete a comment
      
      * Changes:
      - Rename `changes` column to `after` to keep things consistent
      - If a group  has no General Permisions, it'll not be included in the graph
      - Update tests and some docs
      
      * fix failing tests in ee
      
      * add some tests and make docstring completes
      
      * polishing comments
      
      * namespaces
      
      * fix namespaces
      
      * Add general permisison flags to `GET /api/user/current` (#21250)
      
      * return general permisison flags for /api/current
      
      * namespaces
      
      * move permission flags to under
      
      * Enforce Subscription permissions (#21285)
      
      * return general permisison flags for /api/current
      
      * namespaces
      
      * enforce general permissions for subscription and tests
      
      * update check-has-general-permisison to add option to require superuser
      
      * adding arity
      
      * add tests for permissions helper function
      
      * Move advanced permissions check funcs to ee namespace
      
      * unpushed changes
      
      * namespaces
      
      * ignore exception when load namespaces
      
      * change helper fn name
      
      * Enforce Monitoring Permissions (#21321)
      
      * return general permisison flags for /api/current
      
      * namespaces
      
      * enforce general permissions for subscription and tests
      
      * update check-has-general-permisison to add option to require superuser
      
      * adding arity
      
      * enforce permissions to call /api/dataset for internal queries
      
      * enforce monitoring permissions for api/task and api/util
      
      * add tests for OSS
      
      * add tests for db-connection-info endpoint
      
      * change test schema
      
      * update name func and fix ns
      
      * whydon't CI run ?
      
      * Enforce Setting Permissions (#21386)
      
      * return general permisison flags for /api/current
      
      * namespaces
      
      * enforce general permissions for subscription and tests
      
      * update check-has-general-permisison to add option to require superuser
      
      * adding arity
      
      * enforce permissions to call /api/dataset for internal queries
      
      * enforce monitoring permissions for api/task and api/util
      
      * add tests for OSS
      
      * add tests for db-connection-info endpoint
      
      * change test schema
      
      * update name func and fix ns
      
      * whydon't CI run ?
      
      * Enforce Setting permissions
      
      * fix failing test
      
      * make sure we could run slack test twice
      
      * make the mock consistent
      
      * address Noah's comments
      
      * shorter permissions check
      Unverified
      e36304ec
    • Noah Moss's avatar
      Unverified
      01092b5c
    • Noah Moss's avatar
      Data model permission writes & reads (#21168) · 2d81ec58
      Noah Moss authored
      Unverified
      2d81ec58
  27. Mar 29, 2022
    • Noah Moss's avatar
    • Ngoc Khuat's avatar
      Add General Permissions graph APIs (#21124) · 57d0ff0a
      Ngoc Khuat authored
      * add API to fetch general permisisons graph
      
      * add API to update general permissionns
      
      * change author of migration
      
      * update documents
      
      * misc fixes to applease the CIs
      
      * Add tests for general permission APIs and models
      
      * linting and fix a failed test case
      
      * fix some failed tests
      
      * update docs and change /subscription/ to /general/subscription/ for consistency
      
      * address noah's comments
      
      * Parse number as is in http-client for tests
      
      * revert the last commit about parsing API response in tests
      
      * change fk name
      
      * Changes:
      - Rename `changes` column to `after` to keep things consistent
      - If a group  has no General Permisions, it'll not be included in the graph
      - Update tests and some docs
      
      * fix failing tests in ee
      
      * add some tests and make docstring completes
      
      * fix namespaces
      Unverified
      57d0ff0a
  28. Mar 28, 2022
Loading