Skip to content

Explicit DemoMode, implemented through an extra state in auth object #21514

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

guido4096
Copy link
Contributor

@guido4096 guido4096 commented May 29, 2025

fixes #18946

@naltatis naltatis self-requested a review May 29, 2025 13:55
@naltatis naltatis self-assigned this May 29, 2025
@naltatis naltatis added enhancement New feature or request ux User experience/ interface labels May 29, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @guido4096 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@naltatis
Copy link
Member

@guido4096 magst du mal make lint und make lint-ui drüber laufen lassen?

Am Besten aktivierst du in deinem Editor auch "format on save" für "prettier" und "go", dann gibts diese Art von Fehlern erst gar nicht 😀

@guido4096
Copy link
Contributor Author

Maybe a highlight about the changes:

  1. demo mode is activated using --demo
  2. this is implemented using a new state in the auth object. The auth object now has states "enabled", "disabled" and "demomode". Enabled and Disabled work as before. The state demomode makes sure that login is not possible and that all actions that requires a logged in users are denied server side.
  3. the state of "demomode" is then also communicated to the frontend through the regular auth api
    So for on my side this works quite nicely.

@guido4096
Copy link
Contributor Author

guido4096 commented May 30, 2025

One special thing; the auth state is done through an enum, making use of constants. These constants have to be referenced using something like "auth.Disabled" . In most of the functions, the auth object is passed through the variable name "auth" and this hides the constants. So I had find a new name for this variable and used "authObject" .

@guido4096
Copy link
Contributor Author

Documentation needs to be still adapted, but I think better to first get the code and behavior reviewed and correct before doing doc changes.

@naltatis naltatis added the needs documentation Triggers issue creation in evcc-io/docs label May 30, 2025
@guido4096 guido4096 force-pushed the explicit-demo-mode branch from 5a72df3 to fe115e3 Compare June 1, 2025 10:52
@guido4096 guido4096 changed the title DemoMode implemented in authentication Explicit DemoMode, implemented through an extra state in auth object Jun 1, 2025
@guido4096 guido4096 force-pushed the explicit-demo-mode branch from fe115e3 to 3239b62 Compare June 1, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs documentation Triggers issue creation in evcc-io/docs ux User experience/ interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explicit Demo Mode
2 participants