Skip to content

feat: DIA-2208: add flag to enable legacy tokens from cli #7413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 23, 2025

Conversation

pakelley
Copy link
Contributor

@pakelley pakelley commented Apr 23, 2025

Adds a --enable-legacy-api-token flag which results in both legacy and JWT tokens to be enabled in the default Organization. Tested locally that without the flag legacy tokens are not enabled, but with the flag they are enabled.

Fixes #7355
Based on #7388 , created so that CI can run properly.

benglewis and others added 6 commits April 16, 2025 18:47
Add CLI flag and environment variable to enable legacy API token authentication.

* Add `--enable-legacy-api-token` flag to `label_studio/core/argparser.py`.
* Add `LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN` environment variable to `label_studio/core/settings/base.py`.
* Update `docs/source/guide/start.md` to include the new flag and environment variable.
* Modify `label_studio/server.py` to enable legacy API tokens if the flag or environment variable is set.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/HumanSignal/label-studio?shareId=XXXX-XXXX-XXXX-XXXX).
…acy API token support

* **Argument Parser**
  - Add `--enable-legacy-api-token` flag to the argument parser in `label_studio/core/argparser.py`

* **Settings**
  - Add `LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN` environment variable in `label_studio/core/settings/base.py`
  - Set default value to `False`

* **Documentation**
  - Update `docs/source/guide/start.md` to include `--enable-legacy-api-token` and `LABEL_STUDIO_ENABLE_LEGACY_API_TOKEN`

* **Organization Functions**
  - Update `label_studio/organizations/functions.py` to set `legacy_api_tokens_enabled` based on the flag or environment variable

* **Server Initialization**
  - Pass `enable_legacy_api_token` input argument to `create_organization` in `label_studio/server.py`
Copy link

sentry-io bot commented Apr 23, 2025

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: label_studio/server.py

Function Unhandled Issue
_create_user AttributeError: 'Namespace' object has no attribute 'quiet_mode' label_studio.server...
Event Count: 87

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot added the feat label Apr 23, 2025
Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for label-studio-storybook ready!

Name Link
🔨 Latest commit c95c4cc
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-storybook/deploys/6808f6b12c852d0008d052cb
😎 Deploy Preview https://deploy-preview-7413--label-studio-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for label-studio-docs-new-theme ready!

Name Link
🔨 Latest commit c95c4cc
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/6808f6b1960bfb0008ece9ba
😎 Deploy Preview https://deploy-preview-7413--label-studio-docs-new-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for heartex-docs ready!

Name Link
🔨 Latest commit c95c4cc
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/6808f6b1847d01000832ca2a
😎 Deploy Preview https://deploy-preview-7413--heartex-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.38%. Comparing base (b43994d) to head (c95c4cc).
Report is 14 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7413   +/-   ##
========================================
  Coverage    78.37%   78.38%           
========================================
  Files          193      193           
  Lines        15613    15616    +3     
========================================
+ Hits         12237    12240    +3     
  Misses        3376     3376           
Flag Coverage Δ
pytests 78.38% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pakelley pakelley merged commit b4e6bbf into develop Apr 23, 2025
75 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add option to enable legacy API token by default
3 participants