mathiasi opened a new pull request, #40994:
URL: https://github.com/apache/superset/pull/40994

   ### SUMMARY
   
   The \import-directory\ CLI command imports assets (charts, datasets, 
dashboards, databases) without setting an active user (\g.user\). As a result, 
all imported assets are created with an empty \owners\ list — making them 
uneditable in the UI. Attempting to save an imported chart fails because the 
ownership check finds no owner to match against the logged-in user.
   
   All sibling import commands already handle this correctly:
   
   | Command | Has \--username\ | How \g.user\ is set |
   |---|---|---|
   | \import-dashboards\ | Yes (required) | \g.user = 
security_manager.find_user(username=username)\ |
   | \import-datasources\ | Yes (optional, default \dmin\) | 
\override_user(security_manager.find_user(username=username))\ |
   | \legacy-import-dashboards\ | Yes (optional) | \g.user = 
security_manager.find_user(username=username)\ |
   | \import-directory\ | **No** | **Nothing — g.user is None** |
   
   This PR brings \import-directory\ into alignment by adding an optional 
\--username\/\-u\ option (default: \dmin\) using the \override_user\ context 
manager, identical to \import-datasources\. No new imports are required as both 
\override_user\ and \security_manager\ are already imported in the module.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — CLI change only.
   
   ### TESTING INSTRUCTIONS
   
   1. Run \superset import-directory /path/to/assets\ — assets import as 
before, owned by \dmin\ (default)
   2. Run \superset import-directory --username someuser /path/to/assets\ — 
assets are owned by \someuser\
   3. Log in to the UI and verify that imported charts and dashboards are 
editable and saveable
   4. Run \pytest tests/integration_tests/cli_tests.py::test_import_directory 
tests/integration_tests/cli_tests.py::test_failing_import_directory\
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to